Search code examples
c#.netwinapikey

How to convert from Virtual Key codes to System.Windows.Forms.Keys


If I intercept a key press using win32 calls, I now have a key code. Is there a way to convert that to a System.Windows.Forms.Keys value?


Solution

  • The integer values for System.Windows.Forms.Keys enum match that of the Win32 calls.

    Keys keyData = (Keys)rawWin32KeyCode;