Search code examples
c#windowsconstantsmessagingusing

Is WM_KEYDOWN constant defined in C# assemblies?


I am going to use WM_KEYDOWN and other WM_ messages in a C# program. Are these constants defined somewhere or they should be defined in every program manually?


Solution

  • Because these constants are defined in winapi libraries and not .net you will need to recreate them yourself somewhere. The functions that use these constants are also defined in winapi and so you will need to use interop to use them in your applications. http://www.pinvoke.net/ is a good resource for protyping the interop versions of these winapi constants and functions.