How to make an application that can capture all click when you press the Enter key, but in my WinForm as well?

一个人想着一个人 提交于 2019-11-28 10:33:40

问题


i try to develop an application who make a screenshot all mouseclick and when i hit the key "enter" for make a tutorial, but i don't see how capture this events where they are outside of my application. How i can do that ???


回答1:


use this project "Processing Global Mouse and Keyboard Hooks in C#". I used it before and I personally always recommend it.

How to use it:

add reference tot the Gma.UserActivityMonitor dll to your project.

using Gma.UserActivityMonitor.GlobalEventProvider;

_globalEventProvider1 = new Gma.UserActivityMonitor.GlobalEventProvider();

this._globalEventProvider1.KeyDown += HookKeyDown;//to listen to key down
this._globalEventProvider1.KeyUp += HookKeyUp;//to listen to key down                
this.globalEventProvider1.MouseDown += HookMouseDown;//to listen to mouse down 
this.globalEventProvider1.MouseUp += HookMouseUp;//to listen to mouse up 

//and a lot more...



回答2:


You need to have a look in to implementing windows hooks.



来源:https://stackoverflow.com/questions/6871023/how-to-make-an-application-that-can-capture-all-click-when-you-press-the-enter-k

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