如何从虚拟密钥代码转换为System.Windows.Forms.Keys

时间:2021-06-11 21:10:29

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?

如果我使用win32调用拦截按键,我现在有一个密钥代码。有没有办法将其转换为System.Windows.Forms.Keys值?

2 个解决方案

#1


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

System.Windows.Forms.Keys枚举的整数值与Win32调用的整数值匹配。

Keys keyData = (Keys)rawWin32KeyCode;

#1


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

System.Windows.Forms.Keys枚举的整数值与Win32调用的整数值匹配。

Keys keyData = (Keys)rawWin32KeyCode;

#2