获取 RegisterWindowMessage 注册的消息名称
Get Name of Message registered by RegisterWindowMessage
我正在调试旧应用程序,其中 WndProc 被覆盖。在那里我收到一条 ID=0xC1B0 的消息,这意味着,根据 msdn article.
,这是一条系统范围内的唯一消息
正如微软对 RegisterWindowMessage(...)
所描述的那样,相同的字符串参数会产生相同的消息 ID。所以message-id和参数之间有唯一的link
我现在的问题是:如果我有message-id,是否有可能获取参数?如果是的话,这可能会帮助我找到消息的来源。
如本文中所见,blog there is no direct way, but the function GetClipboardFormatName(...)
提供了解决该问题的方法。
我是这样使用的:
[DllImport("user32.dll")]
static extern int GetClipboardFormatName(int format, StringBuilder lpszFormatName, int cchMaxCount);
public static string GetMessageName(int msg)
{
var sb = new StringBuilder(256);
GetClipboardFormatName(msg, sb, sb.Capacity);
return sb.ToString();
}
我正在调试旧应用程序,其中 WndProc 被覆盖。在那里我收到一条 ID=0xC1B0 的消息,这意味着,根据 msdn article.
,这是一条系统范围内的唯一消息正如微软对 RegisterWindowMessage(...)
所描述的那样,相同的字符串参数会产生相同的消息 ID。所以message-id和参数之间有唯一的link
我现在的问题是:如果我有message-id,是否有可能获取参数?如果是的话,这可能会帮助我找到消息的来源。
如本文中所见,blog there is no direct way, but the function GetClipboardFormatName(...)
提供了解决该问题的方法。
我是这样使用的:
[DllImport("user32.dll")]
static extern int GetClipboardFormatName(int format, StringBuilder lpszFormatName, int cchMaxCount);
public static string GetMessageName(int msg)
{
var sb = new StringBuilder(256);
GetClipboardFormatName(msg, sb, sb.Capacity);
return sb.ToString();
}