您可以重新映射特定键盘的键吗? [英] Can you remap keys of a specific keyboard?

查看:110
本文介绍了您可以重新映射特定键盘的键吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算机上连接了两个键盘.普通的全尺寸键盘和数字键盘.我想重新映射"数字小键盘上的键,但不要理会整个键盘.因此,当用户在小键盘上按下"5"时,它将重新映射到媒体播放"键,但是如果在全键盘的小键盘上按下相同的"5",我将得到"5".本质上,我想将单独的数字小键盘变成媒体控制设备.

I've got two keyboards attached to my computer. A normal full-size keyboard and a numeric keypad. I want to "remap" the keys on the numeric keypad, but leave the full keyboard alone. So, when the user presses "5" on the keypad it would get remapped to the "Media Play" key, but if the same "5" was pressed on the keypad of the full keyboard, I'd get a "5". In essence, I want to turn that seperate numeric keypad into a media control device.

不幸的是,我不确定如何进行这项工作. Windows有一个原始输入"功能,它可以区分键盘,但是只允许读取键-不能重新映射它们.有键盘钩子(低级和高级)可以重新映射击键,但它们不能区分键盘.

Unfortunately I'm not sure how to make this work. There is a "Raw Input" feature of Windows which allows to distinguish between keyboards, but that only allows to read the keys - not remap them. There are keyboard hooks (low level and high level) which can remap the keystrokes, but they don't distinguish between keyboards.

我可以将两种方法结合使用吗?为此,我必须确保在键盘钩插入之前处理原始输入消息.是这样吗?

Can I make a combination of the two methods work? For that I'd have to be sure that the raw input message is processed before the keyboard hook kicks in. Is that so?

此外,我已经读到Windows由于某种原因不允许在同一过程中使用Raw Input和Keyboard Hooks.我可以通过执行两个不同的过程来解决此问题,但是由于通信延迟(键盘挂钩在必须完成工作的时间非常有限的情况下),该问题变得更加脆弱.

Also, I've read that Windows for some reason does not allow to use Raw Input and Keyboard Hooks in the same process. I could work around that by making 2 different processes, but that becomes more fragile because of communication latency (keyboard hooks have very limited time in which they must complete their work).

这完全可行吗?

推荐答案

最后,事实证明,我需要一个自定义键盘驱动程序来完成此操作.幸运的是,我找到了一个可以服用的药物-拦截.该应用已准备就绪,可以正常运行. :)

In the end it turned out I needed a custom keyboard driver to accomplish this. Fortunately I found one ready for taking - Interception. The app is ready and works perfectly. :)

这篇关于您可以重新映射特定键盘的键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆