确定窗口消息的优先级

确定窗口消息的优先级

本文介绍了确定窗口消息的优先级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有以编程方式检查窗消息的优先级在消息队列?

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

例如:某些窗口消息, WM_PAINT WM_TIMER 已知的优先级最低,并放置后消息以最高优先级。

For example: Some of window messages, WM_PAINT and WM_TIMER are known have the lowest priority and be placed after messages with highest priority.

我在找的东西,通过它可以确认这两个消息中的一个将具有最低或最高优先级或消息将首先发送或持续多久?

I'm looking for something by which you can confirm that which one of two messages will have the lowest or highest priority or which message will be sent first or last?

推荐答案

这只是不是它的工作原理,Windows消息不具有优先连接。它主要由是如何产生的消息确定。消息循环分派在这个订单消息:

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:


  • 先用SendMessage函数()生成的任何消息在其呼叫的时间顺序被分派

  • 下,使用于PostMessage(生成),并存储在消息队列中的任何消息,在队列顺序

  • 旁边时,从窗口状态合成的任何消息。 WM_TIMER,WM_PAINT和WM_MOUSEMOVE这一类适合。

在'从窗口状态合成条款是什么使WM_PAINT和WM_TIMER似乎有一个低优先级。而为什么快速移动鼠标不能用鼠标消息充斥消息队列。然而,这并不是排他性的,可以例如该调用UpdateWindow()来强制WM_PAINT消息要发送,使得它被派遣一个高优先级。

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'.

这篇关于确定窗口消息的优先级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 10:57