As we well know, the window manager generates various messages on-demand rather than posting them into the queue at the time the event occurs. But what happens if you manually post one of these messages, like PostMessage(hwnd, WM_PAINT, 0, 0)
? Does that clear the internal flag that says “This window needs a paint message?”
Nope.
The window manager does not have a prank call detector. If you post a fake WM_PAINT
message, then a fake WM_PAINT
message shows up in the message queue. The part of the window manager which manages the “Does this window need to be repainted?” does not wiretap every telephone call to see if somebody is prank-calling a window with the WM_PAINT
message, and then say, “You know what? I’m going to make that prank call a reality and make it act like a real WM_PAINT
message.”
Imagine if the act of prank-calling somebody caused Prince Albert to stop by for a visit!
In particular, the posted message goes into the posted message queue and will rise to the front of the queue as messages are retrieved. On the other hand, the auto-generated message will remain in its proto-message state until the queue is finally empty.
It then follows as a consequence that if you post one of these auto-generated messages, like WM_TIMER
message, you don’t get any magical coalescing behavior because the coalescing happens as part of the auto-generation, not as part of the PostMessage
. These prank-call messages also appear in the message queue in posted order rather than being generated at low priority like normal auto-generated messages.
0 comments