Following on from the question asked by Mykroft
接下来是Mykroft提出的问题
Best way to handle input from a keyboard “wedge”
处理键盘“wedge”输入的最佳方法
Best way to handle input from a keyboard "wedge".
处理键盘“楔形”输入的最佳方法。
I need to write a class that intercepts key strokes, if the input is determined to be from the keyboard wedge (as described in the above post) the data will be directed to POS classes to handle, otherwise they keystrokes must be passed on to be handled in windows in the normal manner. This raises two questions
我需要编写一个拦截击键的类,如果输入被确定来自键盘楔(如上文所述),数据将被定向到POS类来处理,否则它们的键击必须被传递给以正常方式在Windows中处理。这提出了两个问题
-
How can I intercept key strokes when not in a WinForm.
如何不在WinForm中拦截击键。
-
How can I pass on the keypresses to windows.
如何将按键传递给窗口。
Thanks JDibble
1 个解决方案
#1
1
You'll need to P/Invoke SetWindowsHookEx(). The only hook that will work in a .NET app is WH_KEYBOARD_LL. You should get loads of hits on example code when you Google these keywords.
你需要P / Invoke SetWindowsHookEx()。可以在.NET应用程序中使用的唯一钩子是WH_KEYBOARD_LL。当您使用Google这些关键字时,您应该在示例代码上获得大量点击。
#1
1
You'll need to P/Invoke SetWindowsHookEx(). The only hook that will work in a .NET app is WH_KEYBOARD_LL. You should get loads of hits on example code when you Google these keywords.
你需要P / Invoke SetWindowsHookEx()。可以在.NET应用程序中使用的唯一钩子是WH_KEYBOARD_LL。当您使用Google这些关键字时,您应该在示例代码上获得大量点击。