WH_KEYBOARD和WH_KEYBOARD_LL区别? [英] difference between WH_KEYBOARD and WH_KEYBOARD_LL?

查看:1018
本文介绍了WH_KEYBOARD和WH_KEYBOARD_LL区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是两个工作之间的区别?对于 WH_KEYBOARD_LL 我读,它安装监视的低级别的键盘输入事件钩子程序。何谓的低级别的键盘事件?

what is the difference between the working of two ? For WH_KEYBOARD_LL i read that it Installs a hook procedure that monitors low-level keyboard input events. What is meant by low-level keyboard events ?

推荐答案

咩,不注重术语太多,不澄清什么。还有的两者之间的巨大差异。 WH_KEYBOARD_LL将安装需要自己的程序中实现回调的钩子。你必须泵消息循环,以便Windows可以在回调时,它是关于派遣一个键盘消息。这使得它很容易走了。

Meh, don't focus too much on the term, it doesn't clarify anything. There's a huge difference between the two. WH_KEYBOARD_LL installs a hook that requires the callback to be implemented in your own program. And you must pump a message loop so that Windows can make the callback whenever it is about to dispatch a keyboard message. Which makes it really easy to get going.

WH_KEYBOARD工作得非常不同,它需要能够安全地注入钩状流程的DLL。这使得它非常难以得到持续,在不影响进程注入DLL文件是不容易的。特别是在64位操作系统。也不是,如果采取一些其他进程需要了解的击键你需要的进程间通信的照顾。就像一个键盘记录。

WH_KEYBOARD works very differently, it requires a DLL that can be safely injected into hooked processes. Which makes it notoriously difficult to get going, injecting DLLs without affecting a process isn't easy. Particularly on a 64-bit operating system. Nor is taking care of the inter-process communication you might need if some other process needs to know about the keystroke. Like a key logger.

WH_KEYBOARD的优点在于,它可以访问键盘状态。这是在Windows中的每个进程财产。当你想使用挂钩,以虚拟按键转化为自己打字键,如活动键盘布局,修改和死键的状态状态关系很大。你不能可靠地从外部进程调用ToUni codeEX()。

The advantage of WH_KEYBOARD is that it has access to the keyboard state. Which is a per-process property in Windows. State like the active keyboard layout and the state of the modifier and dead keys matter a great deal when you want to use the hook to translate virtual keys to typing keys yourself. You can't reliably call ToUnicodeEx() from an external process.

您不能没有运行到例如code摆动一只猫,谷歌会给你足够。所以一定要使用一些被称为对工作,如果你以前从来没有这样的钩子写的,这将避免很多麻烦。

You can't swing a cat without running into example code, google will give you plenty. So be sure to use something known-to-work if you have never written such a hook before, it will avoid a lot of grief.

这篇关于WH_KEYBOARD和WH_KEYBOARD_LL区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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