我可以指定我的 C++ 的 HID 吗?程序监听
我正在尝试创建一个从 HID 读取键盘输入的应用程序。我试图实现这一目标的操作系统是 Windows 7。我会以什么方式指定我的程序只需要侦听一个 HID 设备(我有一个普通键盘和一个 RFID 读取器作为我的两个设备)如果我只想听一个 HID 并忽略其他击键(从键盘),请告诉我最佳路线
I am trying to create an application that reads keyboard input from a HID. The OS I am trying to acheive this on is Windows 7. In what way would I specify to my program that it needs to listen to just one HID device (I have a normal keyboard, and an RFID reader as my two devices) Could some one tell me the best route to take if I wanted to just listen to one HID and ignore other keystrokes (From the keyboard)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否使用
RegisterRawInputDevices()
注册了 HID 输入?因为在这种情况下,您需要告诉 Windows 您需要哪些设备的“原始”输入。[编辑]
粗略草图:
Did you register for HID input with
RegisterRawInputDevices()
? Because in that case, you tell Windows for which devices you want "raw" input.[edit]
Rough sketch:
您可能应该处理
WM_INPUT
消息并检查lParam
输入结构中的hDevice
。请参阅 http://msdn.microsoft.com/ en-us/library/ms645590%28v=VS.85%29.aspxYou should probably handle the
WM_INPUT
message and checkhDevice
in thelParam
input structure. See http://msdn.microsoft.com/en-us/library/ms645590%28v=VS.85%29.aspx