<i id='P7l42'><tr id='P7l42'><dt id='P7l42'><q id='P7l42'><span id='P7l42'><b id='P7l42'><form id='P7l42'><ins id='P7l42'></ins><ul id='P7l42'></ul><sub id='P7l42'></sub></form><legend id='P7l42'></legend><bdo id='P7l42'><pre id='P7l42'><center id='P7l42'></center></pre></bdo></b><th id='P7l42'></th></span></q></dt></tr></i><div id='P7l42'><tfoot id='P7l42'></tfoot><dl id='P7l42'><fieldset id='P7l42'></fieldset></dl></div>

        <tfoot id='P7l42'></tfoot>
      1. <small id='P7l42'></small><noframes id='P7l42'>

      2. <legend id='P7l42'><style id='P7l42'><dir id='P7l42'><q id='P7l42'></q></dir></style></legend>
          <bdo id='P7l42'></bdo><ul id='P7l42'></ul>

        多个键盘和低级挂钩

        Multiple keyboards and low-level hooks(多个键盘和低级挂钩)

        <i id='Uj3Al'><tr id='Uj3Al'><dt id='Uj3Al'><q id='Uj3Al'><span id='Uj3Al'><b id='Uj3Al'><form id='Uj3Al'><ins id='Uj3Al'></ins><ul id='Uj3Al'></ul><sub id='Uj3Al'></sub></form><legend id='Uj3Al'></legend><bdo id='Uj3Al'><pre id='Uj3Al'><center id='Uj3Al'></center></pre></bdo></b><th id='Uj3Al'></th></span></q></dt></tr></i><div id='Uj3Al'><tfoot id='Uj3Al'></tfoot><dl id='Uj3Al'><fieldset id='Uj3Al'></fieldset></dl></div>
          <tbody id='Uj3Al'></tbody>

              <legend id='Uj3Al'><style id='Uj3Al'><dir id='Uj3Al'><q id='Uj3Al'></q></dir></style></legend>
                <tfoot id='Uj3Al'></tfoot>
                  <bdo id='Uj3Al'></bdo><ul id='Uj3Al'></ul>

                  <small id='Uj3Al'></small><noframes id='Uj3Al'>

                  本文介绍了多个键盘和低级挂钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个系统,我有多个键盘,并且确实需要知道击键来自哪个键盘.解释设置:

                  I have a system where I have multiple keyboards and really need to know which keyboard the key stroke is coming from. To explain the set up:

                  1. 我有一台普通的 PC 和 USB 键盘
                  2. 我有一个带有一些硬键的外部 VGA 屏幕
                  3. 硬键映射为标准 USB 键盘,发送有限数量的键码(F1、F2、Return、+ 和 -)

                  我有一个低级挂钩(在 C# 中,但实际上调用 Win32 功能),即使我的应用程序没有获得焦点,它也能够处理输入.

                  I have a low-level hook (in C# but actually calling upon Win32 functionality) which is able to deal with the input even when my application is not focused.

                  问题在于,当使用普通键盘时,某些映射的键码会被外部屏幕上驱动的应用程序拾取.外部屏幕发送并用于确认的按键之一是 VK_RETURN.除非我可以识别设备"并对其进行过滤,否则用户可能正在执行操作并在他们甚至没有看的屏幕上确认它们.

                  The problem is that when using the normal keyboard, some of the mapped key-codes at picked up by the application being driven on the external screen. One of the key-presses sent by the external screen and used for confirmation is VK_RETURN. Unless I can identify the "device" and filter upon it, the user could be performing actions and confirming them on a screen their not even looking at.

                  我怎么知道是哪个键盘造成了按键?

                  How do I know which keyboard was responsible for the key-press?

                  推荐答案

                  是的,我纠正了,我的错,每天都在学习新的东西.

                  Yes I stand corrected, my bad, learning something new every day.

                  这是我弥补它的尝试:):

                  Here's my attempt at making up for it :) :

                  • 使用 ::RegisterRawInputDevices() 注册您想要用于原始输入的设备(两个键盘).

                  • Register the devices you want to use for raw input (the two keyboards) with ::RegisterRawInputDevices().

                  您可以从 GetRawInputDeviceList() 获取这些设备

                  You can get these devices from GetRawInputDeviceList()

                  注册设备后,您将开始收到 WM_INPUT 消息.

                  After you've registered your devices, you will start getting WM_INPUT messages.

                  WM_INPUT 消息的 lParam 包含一个 RAWKEYBOARD 结构,您可以使用它来确定输入来自的键盘,以及虚拟键码和消息类型(WM_KEYDOWN、WM_KEYUP、...)

                  The lParam of the WM_INPUT message contains a RAWKEYBOARD structure that you can use to determine the keyboard where the input came from, plus the virtual keycode and the type of message (WM_KEYDOWN, WM_KEYUP, ...)

                  因此,您可以设置最后一条消息的来源标志,然后将其发送到常规键盘输入处理程序.

                  So you can set a flag of where the last message came from and then dispatch it to the regular keyboard input handlers.

                  这篇关于多个键盘和低级挂钩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Performance overhead of using attributes in .NET(在 .NET 中使用属性的性能开销)
                  Accessing attribute info from DTE(从 DTE 访问属性信息)
                  c# Hide a property in datagridview with datasource(c#使用数据源隐藏datagridview中的属性)
                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  C# Attributes and their uses(C# 属性及其用途)
                  C# - Getting all enums value by attribute(C# - 按属性获取所有枚举值)
                  <i id='tm3zn'><tr id='tm3zn'><dt id='tm3zn'><q id='tm3zn'><span id='tm3zn'><b id='tm3zn'><form id='tm3zn'><ins id='tm3zn'></ins><ul id='tm3zn'></ul><sub id='tm3zn'></sub></form><legend id='tm3zn'></legend><bdo id='tm3zn'><pre id='tm3zn'><center id='tm3zn'></center></pre></bdo></b><th id='tm3zn'></th></span></q></dt></tr></i><div id='tm3zn'><tfoot id='tm3zn'></tfoot><dl id='tm3zn'><fieldset id='tm3zn'></fieldset></dl></div>
                  <tfoot id='tm3zn'></tfoot>

                          • <bdo id='tm3zn'></bdo><ul id='tm3zn'></ul>
                              <tbody id='tm3zn'></tbody>
                          • <legend id='tm3zn'><style id='tm3zn'><dir id='tm3zn'><q id='tm3zn'></q></dir></style></legend>

                            <small id='tm3zn'></small><noframes id='tm3zn'>