Search code examples
c#winformswindows-messages

Where to find info about WM Windows Message codes?


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?


Solution

  • 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.