'Get Name of Message registered by RegisterWindowMessage

I am debugging an old application, where the WndProc is overridden. There I got a message with ID=0xC1B0 which means, that this is a system wide unique message according to this msdn article.

As described by microsoft for the RegisterWindowMessage(...), the same string s the paramter results in the same message-id. So there is an unique link between the message-id and the parameter.

My question is now: Is there a possibility to get the parameter, if I have the message-id? If yes, this might help me to find the source of the message.



Solution 1:[1]

As found in the this blog there is no direct way, but the function GetClipboardFormatName(...) gives a work around for the problem.

I used it in the following way:

[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();
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Simon Mourier