Notes:
1. Message Processing Method
In Windows, messages are processed in two ways: one is to directly call wndproc using messages as parameters, and the other is to add messages to message queues.
Therefore, neither getmessage () nor peekmessage () can receive all the messages, but can only receive the messages in the message queue.
. Windows systems can call wndproc () at any time without havingProgramRequest. For example, when createwindow () is used
The wm_create message calls wndproc ....
Of course, dispatchmessage () Requests also enable Windows to call wndproc. Dispatch () will not be returned until the message processing is complete.
2. message about wm_paint
When the window is invalid, the system adds the wm_paint message to the window message queue. The message must be processed, and the window is validate after processing; otherwise, the message
It cannot be eliminated in the queue, causing the program to remain in getmessage (wm_paint), wndproc (wm_paint ),...... Another solution is
Let defwindowproc () process the wm_paint message so that the window is validated.
3. About defwindowproc ()
This function is required and automatically processes certain messages. If these messages are not correctly processed, the program may be abnormal.
4. message about wm_destroy
This message must be processed by a programmer, generally postquitmessage (0); otherwise, the startup is destroyed and the program is still running.