原始输入替代键盘挂钩? [英] Raw Input an alternative keyboard hook?

查看:42
本文介绍了原始输入替代键盘挂钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问 --

我正在阅读有关键盘挂钩的信息,有人建议使用原始输入来执行此操作,但我还没有找到任何示例.例如我正在使用

I was reading about keyboard hooks and one suggested using Raw Input to do this, yet I havn't found any example of it. For example I am using

RAWINPUTDEVICE rid[1];
rid[0].usUsagePage = 0x01;
rid[0].usUsage = 0x06;
rid[0].hwndTarget = hWnd;
rid[0].dwFlags = 0;
RegisterRawInputDevices(rid, 1, sizeof(rid[0]));

并且在应用程序自己的窗口中标明 WM_INPUT 很好,但不在应用程序之外.这在应用程序之外是可能的还是必须使用 WH_KEYBOARD 或 WH_KEYBOARD_LL?MSDN 没有明确说明是否可以全局生成原始输入.

And catchign WM_INPUT fine in the applications own window, but not outside the application. Is this possible outside the application or do you have to use WH_KEYBOARD or WH_KEYBOARD_LL? MSDN didn't make it clear if Raw Input could be made globally.

我知道 Hooks,但我想知道您是否也可以使用原始输入来做到这一点!

I know about Hooks but I want to know if you can do it with Raw input too!

干杯

推荐答案

Windows 挂钩是一种机制,可用于在事件到达应用程序之前拦截事件.过滤器函数(接收事件的函数)根据事件类型进行分类.如果要附加到 Windows 挂钩,则必须使用 SetWindowsHookEx 安装过滤器功能.我不得不提到全局钩子必须在一个单独的 dll 文件中.您可以在 MSDN.

A Windows hook is mechanism that one can use to intercept events before they reach an application. Filter functions (functions that receive events) are classified according to the event type. If one wants to attach to a Windows hook, the filter function has to be installed using SetWindowsHookEx. I have to mention that global hooks must be in a separate dll file. You can read more about hooks in MSDN.

这篇关于原始输入替代键盘挂钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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