Monitoring keyboard activity in C# while my application is in the background

微笑、不失礼 提交于 2019-11-30 17:50:17

There is an article that has working sample for what you require(It also monitors keyboard and mouse events in the background) at :

Processing Global Mouse and Keyboard Hooks in C#

Mesh

You'll need to use Window Hooks:

Low-Level Keyboard Hook in C#

But beware, Windows security, may be protecting us from doing what you want!

Joshua Drake

Microsoft tells you How to: Handle Keyboard Input at the Form Level. As long as you handle the same event(s) this works for any non web application.

You should also take a look at the other questions here on SO, such as Handling Input from a Keyboard Wedge

You could register Windows Hot Key with RegisterHotKey windows API, look at this blog post :

http://www.liensberger.it/web/blog/?p=207

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!