我对扩展 Windows 键盘上的按键感兴趣(特别是但不一定限于 Windows 7)。目前,我可以在 C# 应用程序中使用此处提供的密钥:
http://msdn.microsoft.com/en-us/library/system.windows.forms.keys(v=vs.71).aspx
我感兴趣的事情正在扩展可用的键码,以便我可以根据我的特定(可编程键盘)硬件定制它们,然后能够在我的 C#/DirectX 应用程序中注册它们。我知道可以创建热键组合,但我想首先探索这个选项。我的问题是:
A)这种方法完全疯狂吗?
B) if A == false: 有没有人有过
这方面的实际经验。能
你推荐什么好的
我应该的关键词/教程
在看?
I'm interested in extending the keys on the Windows keyboard (specifically - but not necessarily limited to - Windows 7). Currently I can use the keys available here in my C# application:
http://msdn.microsoft.com/en-us/library/system.windows.forms.keys(v=vs.71).aspx
What I'm interested in doing is extending the available keycodes so I can tailor them to my particular (programmable keyboard) hardware, and then be able to register these in my C#/DirectX applications. I know it is possible to create hotkey combinations, but I'd like to explore this option first. My questions are:
A) is this approach completely crazy?
B) if A == false: has anyone had any
practical experience with this. Can
you recommend any good
keywords/tutorials that I should be
looking at?
发布评论
评论(1)
据我了解,Windows 仅接受基于键枚举的鼠标/键盘输入(无人管理世界中的虚拟键:http://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx)。这使得您的选项 A 无法在 Windows 上执行。
作为一个具体示例,Windows 仅具有五个鼠标按钮的代码(
LButton
、RButton
、MButton
、XButton1
、< code>XButton2),但您可以购买带有五个以上按钮的鼠标。无法即时创建扩展按钮的新虚拟键代码。为了解决这个限制,像这样的鼠标配备了软件,允许您对按下每个按钮的操作进行编程。通常,您会找到将扩展按钮绑定到其他虚拟键代码的单次按下的选项,甚至可以编写组合多个按键的更复杂的宏。在您的应用程序中,您能做的最好的事情就是确保正确处理 Keys 枚举中的全部值(和修饰符组合)。然后对键盘进行适当的编程。这可能意味着利用一些扩展的虚拟键(例如
BrowserForward
)来立即提供更大的虚拟键代码集,或者生成更复杂的宏来输入快速连续的虚拟键代码。It is my understanding that Windows only accepts mouse/keyboard input based on the Keys enumeration (Virtual-keys in the unmanged world: http://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx). This makes your option A impossible to do on Windows.
As a concrete example Windows only has codes for five mouse buttons (
LButton
,RButton
,MButton
,XButton1
,XButton2
) but you can purchase a mouse that comes with more than five buttons. New virtual-key codes for the extended buttons cannot be created on the fly. To get around this limitation mice like this come with software that allows you to program what a press of each button does. Generally you'll find options to bind the extended buttons to a single press of some other virtual-key code or even write more complex macros that combine multiple key presses.In your application the best you will be able to do is ensure that you properly handle the full range of values (and modifier combinations) from the Keys enumeration. Then program your keyboard appropriately. This may mean taking advantage of some of the extended virtual-keys like
BrowserForward
to make a larger set of virtual-key codes immediately available or generating more complex macros to enter a quick succession of virtual-key codes.