Message Processing Mechanism of Windows Applications

Source: Internet
Author: User

I checked the message processing mechanism today. To prevent future forgetting, I wrote my understanding into my blog.

1. First, any message is transmitted to the operating system, and then the operating system delivers the message to the message queue.

2. In the message queue, extract the message with getmessage () and send it to the application based on the order and weight of the message.

3. After the message is obtained, the application will first perform some preprocessing, for example, discard the response of some messages or call translatemessage () to generate a new message. As for why the function is called, the function is mainly used to process the key information we input. Every time we press a character key, wm_keydown and wm_ketup messages are generated. These two messages contain some additional parameters wparam and lparam, when processing a message, we need to convert the information into wm_char information, which is the role of the translatemessage () function. Information processed by translatemessage () generates new information and is returned to the message queue.

4. pre-processed information will be sent to the operating system through dispathmessage (), and finally the operating system will send the information to the corresponding form function.

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.