Windows is based on a message-driven system that provides system Message Queuing in order to hold messages.
Working principle:
The system will generate the corresponding message and put it into the message queue when monitoring the occurrence of the event. Each Windows application also has its own message queue. When a system message queue is processed, messages belonging to the application are posted to the appropriate message queue. The message loop constantly extracts messages from the message queue. distributed to the corresponding form procedure function to handle.
Such as:
650) this.width=650; "Style=" background-image:none;border-right-width:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-left:0px;padding-right:0px;padding-top:0px; "Title=" O_ Windowsmessage2 "alt=" O_windowsmessage2 "src=" http://images.cnblogs.com/cnblogs_com/ztercel/201107/ 201107221202237414.jpg "border=" 0 "height=" 225 "width=" 473 "/>
To implement message loop mode:
1. Wait mode-Program hangs when no messages are in the queue
2. Non-wait mode – the program does not hang when there is no message in the queue
There are two different ways to differentiate:
The difference is that when there is no message in the message queue, you continue to wait for the message to work or continue to do something else.
This article is from the "None" blog, please be sure to keep this source http://evely.blog.51cto.com/1089422/1637971
Windows Messaging Mechanism