低级键盘钩 [英] Low level keyboard hook

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

问题描述

我刚刚购买了一个新键盘,并且对跟踪整个键盘寿命中我进行了多少按键/击键感兴趣. (我只想记录keyUp,因为我不在乎重复)

I just bought a new keyboard, and I'm interested in tracking exactly how many keypresses/strokes I make during the entire life of the keyboard. (I would want to just record keyUp, as I don't care about repeats)

我一直在寻找实现此目的的最佳方法,但是我什至不知道采用哪种方法,因此我在智能搜索方面遇到了麻烦. 另外,我真正使用过的唯一语言是C#.没有使用C/C ++或WinAPI做任何事情

I've been googling around for the best way to do this, but I don't even know what approach to take, so I'm having trouble searching intelligently. Also, the only language I've really worked with is C#. Haven't done anything with C/C++ or WinAPI

直接修改Win 7驱动程序困难吗? 我确实希望能够从计算机启动时开始记录击键,但这可能并不容易. 我宁愿使用现有的驱动程序或挂钩,因为我真的不在乎现在就学习设备驱动程序.

Is it difficult to modify the Win 7 drivers directly? I do want to be able to record keystrokes from the moment the computer boots, but this may not be easily done. I would prefer to use an existing driver or hook, as I really don't care to get into learning device drivers right now.

我简要介绍了Ctrl2Cap,但是我不知道如何修改类似的内容以适应我的情况.

I've looked briefly at Ctrl2Cap, but I don't know how to modify something like that to suit my case.

我看过的其他问题

  • Writing a keyboard device driver
  • Low level keyboard Hook not at UI thread

这表明编写USB过滤器驱动程序可能有效,但是我不知道从哪里开始. 在Windows c ++中禁用键盘?

This one indicates writing a USB Filter driver may work, but I have no clue where to start on that. Disabling the keyboard in windows c++?

推荐答案

不必走驾驶员路线,这不是出于胆小者的考虑.您可以使用低级键盘钩子,该钩子可以在.NET中正常工作.

It is not necessary to go the driver route, which is not for the faint of heart. You can use use a low level keyboard hook which will work fine from .NET.

我快速进行了检查,并在Codeplex上找到了以下内容 http://globalmousekeyhook.codeplex.com/

I did a quick bing and found the following on codeplex http://globalmousekeyhook.codeplex.com/

它应该带你走

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

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