WindowsMessageOverview
WindowsApplication inputWindowsThe window in which the system sends messages to the application. These windows receive and process messages through the window process, and then return the controlWindows.
Message category
Queue messages and non-queue messages
There are two ways to send messages: queue messages and non-queue messages. The queue message is sent to the system message queue and then to the thread message queue. Non-queue messages are directly sent to the destination window.
The message queue is described as follows:
WindowsMaintain a system Message Queue (System message queue), EachGUIThe thread has a thread Message Queue (Thread message queue).
The mouse and keyboard events are converted from the mouse or keyboard driver into input messages and placed into the system message queue. For exampleWM_MOUSEMOVE,WM_LBUTTONUP,WM_KEYDOWN,WM_CHARAnd so on.WindowsEach time a message is removed from the system message queue, the system determines the window to which it is sent and the thread that created the window, and then puts it into the thread message queue of the window creation thread. The thread Message Queue receives messages sent to the window created by the thread. The thread extracts the message from the message queue and usesWindowsSend it to an appropriate window for processing.
In addition to keyboard and mouse messages, queue messages also haveWM_PAINT,WM_TIMERAndWM_QUIT.
Most messages other than these queue messages are non-queue messages.
System messages and application messages
The message sources can be divided into system-defined messages and application-defined messages.
System messageIDThe range is from0ToWM_USER-1, OrZero X 80000To0 XBFFFF; Application message fromWM_USER(Zero X 0400)0X7FFF, Or0XC000To0 XFFFF;WM_USERTo0X7FFFThe range of messages is used by the application itself;0XC000To0 XFFFF