是否可以确定哪个键盘发送了按键? [英] Is it possible to determine which keyboard sent a keypress?

查看:25
本文介绍了是否可以确定哪个键盘发送了按键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Windows Media Center 遥控器,Windows 将其识别为键盘.当我使用 Windows Media Center 在一个屏幕上播放视频的情况下运行多显示器设置时,遥控器的输入与常规键盘一起被定向到活动窗口.因此,当我在另一个屏幕上执行操作时,Windows Media Center 不会响应遥控器.所以我想我会写一个简单的低级键盘钩子来捕获所有按键事件,确定哪些按键来自遥控器,并将它们重定向到打开的 Media Center 窗口.

I have a Windows Media Center remote that windows recognizes as a keyboard. When I run a multi-monitor setup with Windows Media Center playing a video on one screen, the remote's input is directed to the active window along with the regular keyboard. So when I'm doing something with the other screen, Windows Media Center doesn't respond to the remote. So I thought I'd write a simple low level keyboard hook that traps all key events, determines which presses came from the remote, and redirects those to the open Media Center window.

唯一的问题是,我似乎无法在 Windows API 中为此找到任何内容.有没有办法在不写驱动程序的情况下确定按键的来源?

The only problem is, I can't seem to find anything in the Windows API for this. Is there any way to determine the source of a keypress short of writing a driver?

推荐答案

您可以处理原始输入以处理击键并识别它们来自哪个设备.本文解释如何.

You can handle raw input in order to process keystrokes and identify which device they come from. This article explains how.

这篇关于是否可以确定哪个键盘发送了按键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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