关于消息队列
opengl里有个PeekMessage函数是从消息队列中获取消息,那么怎么确定某个语句表达的信息是不是进入了消息队列? opengl
[解决办法]
据我对LZ意图的理解,LZ要做以下几件事,才可能达到LZ想要的效果。罗列如下:
1. 修改消息循环逻辑
while(TRUE)
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if (msg.message == WM_QUIT)
{
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
2. 自定义窗口消息 WM_USER 。譬如定义消息
#define WM_ROTATE (WM_USER + 0)然后调用 SendMessage() 或者 PostMessage() 将消息置于消息队列。
3. 将消息处理代码从消息循环逻辑里面移到消息回调函数里面,大概如下:
xxx MessageProcessCallBack(...)
{
if (WM_ROTATE消息)
{
/* 旋转视图 */
}
}
[解决办法]
使用Spy++软件。
或者:
Setting a Breakpoint on a Message Received by a Windows Function
You can set message breakpoints to stop the debugger when a particular WndProc function message is received.
Note Message breakpoints work only on x86- or Pentium-based systems.
To set a breakpoint on a message
1.From the Edit menu, click Breakpoints.
The Breakpoints dialog box appears.
2.Click the Messages tab.
3.In the Break At WndProc text box, type the name of the Windows function.
If you are setting a breakpoint during a debug session, the list contains the exported functions in your project.
4.In the Set One Breakpoint For Each Message To Watch list box, select the message.
5.To set another breakpoint, press ENTER, and then repeat steps 3 and 4.
The Breakpoints list displays the currently active breakpoints.
6.Click OK to set the breakpoints.
Note If you interrupt execution while Windows or other system code is running, the results can be unpredictable.