Search code examples
c#winapiuser32msg

Windows SendMessage() msg codes


I use this code:

[DllImport( "User32.dll", EntryPoint = "SendMessage" )]
private static extern int SendMessage( IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam );

This code sends a message to a specific HWND. But I cannot find a list of "msg" codes (2nd parameter) anywhere on the Internet.

Are there any lists with these msg codes?


Solution

  • There are two types of messages that you can send:

    1. System-Defined Messages: You can find documentations for possible values for messages in multiple websites one of them is Microsoft SendMessage, Also this link may be helpful.

    2. Application-Defined Messages: Where an application creates its own messages, however, note that there are some conventions for the message that can be used which are listed here.