如何从虚拟键codeS转换为System.Windows.Forms.Keys转换为、System、codeS、Keys

2023-09-04 02:44:08 作者:低音帝王

如果我用win32的呼叫拦截关键preSS,我现在有一个关键的code。有没有办法将其转换成一个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?

推荐答案

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

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

Keys keyData = (Keys)rawWin32KeyCode;