Messages are divided into inbound messages and non-Inbound messages. A message is sent to the queue dedicated to each thread by windows.ProgramSelf-processing, such messages are basically lost by users
(Wm_keydown, wm_keyup, wm_char, wm_mouse **, and wm_paint, wm_timer, wm_quit) or
The caller calls postmessage and the message generated by postthreadmessage. The so-called non-team message is the message directly sent to the window process, that is, directly calling the window
Other than the preceding messages!
Once a thread establishes at least one window, the system allocates a message queue to it. The main manifestation is that the system allocates a threadinfo structure for it, which has four pointers pointing to
Message Queue, message sending queue, Response Message queue, and virtual input queue. You can call postmessage or
Postthreadmessage. Other message queues are mainly used to process the following transactions. When a thread calls sendmessage to a window created by another thread, the first message sent is
First, it is appended to the sending message queue of the receiving thread. The sending thread is idle and waits for the receiving thread to return its message to the response queue of the sending thread after processing the message, wait until the sending thread is awakened to obtain the message in the response queue.
(That is, the return value after processing the message), continue to execute. The Virtual Input Queue is added to the corresponding thread by converting hardware events into messages by the Windows system thread rit (original input thread ).
In the virtual message queue.
The order in which message queues are processed. First of all, Windows does not process queues in the FIFO order, but has a certain priority. Priority is achieved by the Status mark of the message queue. First, the highest
The first level is the message sent by another thread (via sendmessage), the second is to register the Message Queue message, process the qs_quit mark again, process the virtual input queue, and then process
Wm_paint is finally wm_timer!