在哪里可以找到有关 WM Windows 消息代码的信息?
我在这里和那里看到专业用户回答了很多像我这样的菜鸟问题,诸如 WM_PAINT = 0xf
我应该搜索什么才能获得此代码的完整列表?它们对于所有 Windows 版本都相同吗?它们也可以用于其他平台吗?
I see here and there pro users answer lots of noobs like me questions with things like WM_PAINT = 0xf
What should I search for to get complete list of this codes? are they all the same for all verions of windows? can they also used for other platforms?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
WM_PAINT = 0xf
是某种方法的特定参数。这些“代码”通常需要使用非托管核心库(例如 user32 和 kernel32)进行互操作。您可以在网站 https://pinvoke.net。
例如,您的示例
WM_PAINT
来自 User32.GetMessage。如果您想要特定 WindowsMessage参数,可以找到此处。
如今,微软有一个项目“C#/Win32 P/Invoke Source Generator”来与所有Win32进行互操作蜜蜂。如果您尝试使用 Win32 API,这可能是首选方法。
WM_PAINT = 0xf
is a specific parameter for a certain method. Those "codes" are usually needed with interop stuff, using unmanaged core libraries such as user32 and kernel32.You can find methods and their parameters like that on the site https://pinvoke.net.
For example, your example
WM_PAINT
is from User32.GetMessage.If you want a full list of specific WindowsMessage parameters, they can be found here.
These days Microsoft has a project "C#/Win32 P/Invoke Source Generator" to interop with all the Win32 APIs. If you're trying to use Win32 APIs, that's probably the preferred way of doing it.
此表有帮助吗?
我不确定是否所有 Windows 版本都会发送所有这些消息,但我很确定版本之间的代码没有不同。
Is this table of any help?
I'm not sure whether all Windows versions send all these message, but I'm pretty sure the codes aren't different between versions.
您可以在
WinUser.h
中找到它们。它们无法在 Windows 版本之间进行更改(更改它们会破坏与所有 Windows 程序的二进制兼容性。
You can find these in
WinUser.h
.They cannot change between Windows versions (changing them would break binary compatibility with all Windows programs.
有时我们还需要一条消息的代码(十进制或十六进制)。我发现下表很有用:
https://wiki.winehq.org/List_Of_Windows_Messages
Sometimes we also need a message by its code, decimal or hexadecimal. I find the following table useful:
https://wiki.winehq.org/List_Of_Windows_Messages
官方文档可以在微软网站上与消息使用相关的部分找到。在“桌面”部分中搜索以下名称:该消息通常会给出正确的页面作为第一个结果。在几乎所有情况下,这将包括数值。
WM_NCHITTEST
示例(搜索页面,文档页面):就个人而言,我使用 magnumdb.com,您可以从中搜索十进制或十六进制常量或符号(132 或 0x84 或
WM_NCHITTEST
)。 MagnumDB 是我对大多数 Windows 常量的第一个调用端口,因为它包含了几乎所有可以想象的内容(错误代码、HResults、KnownFolderID、IID、CLSID 等...)。 @SimonMourier 是 MagnumDB 的作者,在 StackOverflow 上也非常活跃。的示例
The official documentation can be found on Microsoft's website in the section related to the use of the message. Searching the "Desktop" section for the name of the message will usually give the correct page as the first result. In almost all cases, that will include the numeric value.
Example with
WM_NCHITTEST
(Search Page, Doc Page):Personally, I use magnumdb.com from which you can search either the constant in decimal or hex or the symbol (132 or 0x84 or
WM_NCHITTEST
). MagnumDB is my first port-of-call for most any windows constant since it includes most everything to be imagined (Error codes, HResults, KnownFolderID, IIDs, CLSIDs, etc...). @SimonMourier is the author of MagnumDB and is also quite active on StackOverflow.我找了很久......
在官方文档上
https://learn.microsoft.com/en-us/windows/win32/winmsg/about-messages-and-message-queues#system-define-messages
在“关于消息和消息队列”页面上”。
段落:消息类型>>系统定义的消息
再往下一点,有一个列表,其中最低条目为“WM General”。
I was looking for it very long...
On the official documentation
https://learn.microsoft.com/en-us/windows/win32/winmsg/about-messages-and-message-queues#system-defined-messages
On page "About Messages and Message Queues".
Paragraph: Message Types >> System-Defined Messages
A little further down there is a list with the lowest entry "WM General".