c - Windows 中的窗口消息 49373 (0xC0DD) 是什么?

标签 c windows winapi graphics

我在w10上使用spyxx来监视我从我的应用程序创建的窗口收到的消息,我注意到日志中的这一行:

<000011> 00000000000A 1022 P message:0xC0DD [Registrato:"TaskbarButtonCreated"] wParam:00000000 lParam:00000000

如果您问自己什么是“registrato”,请考虑它是意大利语中“注册”的意思,现在我的问题是这条消息是什么以及它的目的是什么?我还在定义了其他 ID 的同一个头文件中进行了搜索,但找不到任何具有该值的消息

最佳答案

0xC0DD 位于应用程序在运行时通过RegisterWindowMessage()“注册”的窗口消息范围内。 :

If the message is successfully registered, the return value is a message identifier in the range 0xC000 through 0xFFFF.

根据 MSDN 文档:

The following are the ranges of message numbers.

Range Meaning
0 through WM_USER –1 Messages reserved for use by the system.
WM_USER through 0x7FFF Integer messages for use by private window classes.
WM_APP (0x8000) through 0xBFFF Messages available for use by applications.
0xC000 through 0xFFFF String messages for use by applications.
Greater than 0xFFFF Reserved by the system.

Message numbers in the first range (0 through WM_USER –1) are defined by the system. Values in this range that are not explicitly defined are reserved by the system.

Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.

Message numbers in the third range (0x8000 through 0xBFFF) are available for applications to use as private messages. Messages in this range do not conflict with system messages.

Message numbers in the fourth range (0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different sessions.

Message numbers in the fifth range (greater than 0xFFFF) are reserved by the system.

在本例中,您看到的值是任务栏调用 RegisterWindowMessage("TaskbarButtonCreated") 的结果。正如您可以从其名称中了解到的那样,此消息的目的是在创建窗口的任务栏按钮时通知您的应用程序:

Taskbar Extensions

When an application displays a window, its taskbar button is created by the system. When the button is in place, the taskbar sends a TaskbarButtonCreated message to the window. Its value is computed by calling RegisterWindowMessage(L("TaskbarButtonCreated")). That message must be received by your application before it calls any ITaskbarList3 method.

如果您使用 ITaskbarList3如果您的代码中的接口(interface)与任务栏按钮交互(即显示进度状态等),您需要在运行时注册此消息并等待它到达窗口的消息处理程序,然后才能安全地调用该接口(interface)的方法操作窗口的任务栏按钮。

关于c - Windows 中的窗口消息 49373 (0xC0DD) 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72670935/

相关文章:

c - 如何增加c中二维字符数组元素大小的大小

c - 在 C 中修改链表项的正确方法

c - 缺少 libgcc_s_dw2-1.dll

c# - 如何知道窗口 zorder 何时发生变化

.net - 如何在 .NET 应用程序中为选定操作正确实现 "As Administrator"或 "Run As Administrator"?

c - 读取和保存未知长度字符串的已知行数

c - Visual Studio 在 for 循环后要求分号

c++ - 在当前位置自行移动光标

winapi - 如何将 "wide"字符串读入缓冲区?

c++ - 允许 IFileOpenDialog 选择一个尚未创建的文件