阻止特定键盘的击键 [英] Block keystrokes from a specific keyboard

查看:86
本文介绍了阻止特定键盘的击键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想阻止来自特定键盘的所有击键(由其HID /名称标识,所以我猜它是低级的东西)在它们到达重点应用程序之前就被阻止。但是我仍在使用此禁用的键盘(正在击键)。我想我需要一个应用程序的挂钩,但是我不知道该怎么做。也许您可以给我一些有用的链接?

I would like to block all keystrokes that are coming from a specific keyboard (identified by its HID/Name, so its low level stuff I guess) before they reach the focused application. But I'm still using this disabled keyboard (I'm getting the keystrokes). I think I need an application's hook but I don't know how to do that. Maybe you can give me some useful link?

问候,

编辑:

我认为我需要一个低级钩子,因为关于用户空间,.net框架中没有通用钩子(我的意思是钩住所有现有的窗口和线程)。
此外,我使用RAWINPUT从键盘获取键入的击键。因此,如果我制作了一个钩子来阻止来自特定设备的击键,那么钩子是否也可以阻止RAWINPUT?

I think I need a low-level hook, because general hook (I mean hook all the existing window & threads) aren't available in the .net framework, concerning the user-space. Moreover, I use RAWINPUT to get typed keystrokes from the keyboard. So if I make a hook to block keystroke from a specific device, could the hook block the RAWINPUT as well?

推荐答案

一个应用程序可以通过获取原始输入数据。但是,应用程序需要处理WM_INPUT而不是WM_CHAR,WM_MOUSEMOVE或WM_APPCOMMAND。

An application can distinguish the source of the input by getting raw input data. However the application needs to handle WM_INPUT instead of WM_CHAR, WM_MOUSEMOVE, or WM_APPCOMMAND.

这篇关于阻止特定键盘的击键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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