Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的 Win32 应用程序上使用 Windows Hooks,我在 MFC 应用程序中找到了用于处理发布消息的 ON_REGISTERED_MESSAGE,但是如何在没有 MFC 类的 Win32 中使用此方法?
您使用 RegisterWindowMessage() 来获取消息 ID。然后在 Post/SendMessage() 调用中使用。处理消息的代码也使用完全相同的字符串调用 RegisterWindowMessage。并获得完全相同的消息 ID。并使用 if() 语句检查窗口过程中的匹配项。
ON_REGISTERED_MESSAGE 宏没有做任何事情,它只是隐藏了 if() 语句。