Message handling Mechanisms for Windows applications

Source: Internet
Author: User

(1) The operating system receives a form message from the application and posts the message to the application's message queue .

(2) The application calls the GetMessage function in the message loop to remove a single message from the message queue.

After the message is removed, the application can pre-process the message, for example, discard the response to some messages, or call translatemessage to generate a new message.

(3) The application calls DispatchMessageand passes the message back to the operating system.

The message is represented by the MSG struct object, which includes a handle to the form that receives the message. Therefore, the DispatchMessage function is always properly passed .

(4) The system uses a pointer to a form procedure function saved by the Lpfnwndproc member of the WNDCLASS struct to invoke the form procedure and process the message ("The system sends a message to the application").

The flowchart is as follows:

Message handling Mechanisms for Windows applications

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.