PeekMessage导致软件陷入困境。 [英] PeekMessage cause software stucked.
问题描述
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
if(msg.message==WM_QUIT)
return;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
上面的代码导致程序卡死亡。 CDialog界面无法做出反应。通过日志分析得出结论:程序在代码上部停止。
The code above causes the program card to die。The interface of CDialog can`t reaction。 Draw a conclusion through log analysis:The program stops in the upper code section。
有人可以提供帮助。
推荐答案
您好,
感谢您在此发布。
>>上面的代码导致程序卡死亡.CDialog的界面无法做出反应。通过日志分析得出结论:程序停在上面的代码部分
请提供有关您的代码的更多信息。你把这段代码放在哪里?您是否尝试过使用GetMessage而不是它?
Please provide more information about your code. Where do you put this code section in? Have you tried to use GetMessage instead of it?
PeekMessage类似于GetMessage函数。这两个函数之间的主要区别在于GetMessage在匹配过滤器的消息之前不会返回条件放在队列中,而PeekMessage立即返回,无论
是否消息在队列中。因此,它通常用于在
冗长操作期间检查邮件队列。
PeekMessage is similar to the GetMessage function. The main difference between the two functions is that GetMessage does not return until a message matching the filter criteria is placed in the queue, whereas PeekMessage returns immediately regardless of whether a message is in the queue. So it's usually used to examine a message queue during a lengthy operation.
以下是有关邮件队列的示例文档,您可以参考它。
Here is a sample document about message queue, you could refer to it.
最佳问候,
Baron Bi
Baron Bi
这篇关于PeekMessage导致软件陷入困境。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!