c++ - Message id's in the main application loop
问题描述
I've written a simple Win32 App
in Visual Studio 2019 on Win 10. In the main message loop inside the WinMain
function i have:
while (Msg.message != WM_QUIT) {
if (PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE) > 0) {
TranslateMessage(&Msg);
DispatchMessage(&Msg);
swprintf_s(msgbuf, _T("In the PeekMessage loop cnt: %d, msg: %d\n"), loop_cnt++, Msg.message);
OutputDebugString(msgbuf);
}
...
}
I get following output:
In the PeekMessage loop cnt: 0, msg: 799
In the PeekMessage loop cnt: 1, msg: 49300
In the PeekMessage loop cnt: 2, msg: 96
In the PeekMessage loop cnt: 3, msg: 96
In the PeekMessage loop cnt: 4, msg: 275
In the PeekMessage loop cnt: 5, msg: 275
...
The odd is that the messages id's returned to the output like 799
or 49300
doesn't exist in the WinUser.h! So my question is what that messages are and where it comes from?
解决方案
799 is WM_DWMNCRENDERINGCHANGED.
49300 is a registered message (i.e. its value is in the range 0xC000-0xFFFF).
推荐阅读
- python-3.x - 我可以在 python 中使用变量从 Postgresql 中提取数据吗?
- node.js - 使用 axios、Node.js 连接到 Azure Blob 存储 REST API
- python - 找不到满足要求的版本 github-repo==2019.2.23 (来自 -r /tmp/build_ae8c4ea0_/requirements.txt () (来自版本:无)
- c# - 控制台应用程序 c# 中的平面文件格式
- java - 谷歌云运行 Java SDK
- c++ - 包含 SDL2/SDL_Image 时 SDL 包含错误
- python - 在网格中标记相邻单元面
- javascript - 如何检查按钮是否被单击,在其上放置一个值,然后使用innerHTML?
- javascript - Why href link is not adding to the html using jquery
- java - JavaFX:打开新窗格时返回 NullPointerException