Determine priority of a window message

后端 未结 2 1647
感情败类
感情败类 2020-12-18 10:20

Is there any way to programmatically check the priority of a window messages in its message queue?

For example: Some of window messages, WM_PAINT and

2条回答
  •  庸人自扰
    2020-12-18 10:51

    That's just not how it works, Windows messages don't have a priority attached. It is mostly determined by how the message is generated. A message loop dispatches messages in this order:

    • first any messages generated with SendMessage() are dispatched in the order in which the calls were made
    • next, any messages generated with PostMessage() and stored in the message queue, in queue order
    • next, any messages that are synthesized from the window state. WM_TIMER, WM_PAINT and WM_MOUSEMOVE fit this category.

    The 'synthesized from the window state' clause is what makes WM_PAINT and WM_TIMER appear to have a low priority. And why moving the mouse rapidly doesn't flood the message queue with mouse messages. That is however not exclusive, you can for example call UpdateWindow() to force a WM_PAINT message to be sent, making it being dispatched with a 'high priority'.

提交回复
热议问题