www.winprog.org Reading notes

Source: Internet
Author: User

GetMessage returns 1 when an error is encountered, even if its return value is defined as bool. Because bool is defined as UINT.
The correct notation for calling GetMessage is while (GetMessage (&msg, NULL, 0, 0) > 0), which correctly handles the error of the function and the exit of the program.

You can use PostMessage or SendMessage to send messages. PostMessage the message into the message queue and returns immediately. This means that the message may or may not have been processed after you call PostMessage. SendMessage the message to the window and does not return until the window has finished processing the message.

Modal dialogs There are some important differences between the process and the window process, where the first 2nd also applies to the Non modal dialog box.

    1. Do not call DefWindowProc () for messages that you do not process. This is done automatically in the dialog box, and you will have a problem if you really want to call it yourself.
    2. Returns true for unhandled messages that return false.
    3. Do not call DestroyWindow to close a dialog box, and call EndDialog ().
    4. Do not handle wm_create, instead, handle the WM_INITDIALOG message to do any action before the dialog box appears.

With Createdialog, you can create a non-modal dialog box that does not have its own message loop. DialogBox () has its own message loop and returns until the dialog box is closed.
The non-modal dialog procedure does not need to call EndDialog and can call DestroyWindow like a regular window.

A dialog box is a window, and most of the dialog's APIs can work in any window.

www.winprog.org Reading notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.