即使未聚焦,也可以从我的APP中从特定键盘(USB端口)获取输入

get inputs from specific keyboard (USB port) just in my APP even when its not focused
2021-07-22
  •  译文(汉语)
  •  原文(英语)

情况:

我有两个键盘连接到一台计算机(均使用USB电缆).

两个问题:

  1. 当我的应用程序不集中时如何获得键盘输入
  2. 从特定键盘获取所有输入,并阻止其输入供其他应用程序使用.

我希望两个用户使用一台具有两个Keyboards的计算机工作,一个可以与我的应用程序一起工作,一个特定的键盘,另一个用户可以在使用其他软件的同时使用另一个键盘.键盘端口永远不会改变.可能有朋友吗?我该怎么办?

速聊1:
我不确定是否可以区分键盘.但应该可以读取输入,并防止使用系统挂钩将其传递给其他应用.msdn.microsoft.com/en-us/library/windows/desktop/…msdn.microsoft.com/en-us/library/windows/desktop/….老实说,如果只有一个人,为什么需要两个键盘.也许vim或Emacs之类的某些键绑定可以解决问题.
速聊2:
感谢您的回复,有两个人,其中一个永远不会看到监视器,只需要使用一个键盘就可以在队列中拨打电话.
解决过程1

http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard

我前一段时间将此用于项目,应该这样做.

The situation :

I have two Keyboards connected to a single computer (both with USB cable).

Two problems :

  1. How can I get keyboard inputs when my application is not focused
  2. Get all inputs from specific keyboard and block its inputs for other applications.

I want two Users to work with one Computer with two Keyboards, one works just with my application, with one specific Keyboard and another user, can use the other Keyboard while working with the other software. Keyboard ports never changes. is it possible friends ? and how can i do that?

Talk1:
I am not sure if you can differentiate between the keyboards. but it should be possible to read input and prevent it from getting delivered to other apps using system hooks. msdn.microsoft.com/en-us/library/windows/desktop/… And msdn.microsoft.com/en-us/library/windows/desktop/… . To be honest why do you need two keyboards if there is only one person. Maybe some key bindings like vim or Emacs might do the trick.
Talk2:
thanks for reply, there are two person, one of them never see monitor and just work with one keyboard to call numbers in a queue.
Solutions1

http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard

I used this for a project a while back, this should do it.

转载于:https://stackoverflow.com/questions/17378082/get-inputs-from-specific-keyboard-usb-port-just-in-my-app-even-when-its-not-fo

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入