我试图无辜地打电话
PeekMessage(&msg,WM_KEYDOWN,WM_KEYUP,PM_NOREMOVE | PM_NOYIELD);
PeekMessage调用中的Windows Vista 64正在处理消息.结果是我将重新加入我的绘画调用以及各种其他代码.
绘画在我们的应用程序中可能需要几秒钟,因此我们添加了PeekMessage调用以查看用户是否按下了某个键,因此我们可以中断该绘画并启动下一个绘画.我们几乎没有意识到Windows可以开始处理我们的消息.将绘画的真实作品放在一个单独的线程中是一个重大的重构…我们试图看看是否按下了特定键,或者是否旋转了鼠标滚轮或鼠标按钮来中断渲染.
我已经尝试专门添加代码以防止重新进入,然后将绘制消息重新注入队列等等.这些都非常困难,并且有些情况下它不能正常工作.
是否有一些我可以添加到PeekMessage调用的标志?我在MSDN上的文档中没有看到任何新内容.我真的需要一个不处理消息的PeekMessage.救命!
解决方法
也许我错过了明显的,但
spec is pretty verbose它会这样做:
The PeekMessage function dispatches incoming sent messages,checks the thread message queue for a posted message,and retrieves the message (if any exist).
…
During this call,the system delivers pending,nonqueued messages,that is, messages sent to windows owned by the calling thread using the SendMessage, SendMessageCallback, SendMessageTimeout,or SendNotifyMessage function. Then the first queued message that matches the specified filter is retrieved. The system may also process internal events. If no filter is specified, messages are processed in the following order:
- Sent messages
- Posted messages
- Input (hardware) messages and system internal events
- Sent messages (again)
-
WM_PAINT messages
- WM_TIMER messages
To retrieve input messages before posted messages,use the wMsgFilterMin and wMsgFilterMax parameters.
(编辑:ASP站长网)
|