我尝试开发一个应用程序,该应用程序在所有鼠标单击时都制作屏幕截图,当我按下输入"键以制作教程时,但我看不到如何在我的应用程序之外捕获这些事件.我怎么能这样做???
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 ???
使用这个项目 在 C# 中处理全局鼠标和键盘挂钩".我以前用过,我个人一直推荐它.
use this project "Processing Global Mouse and Keyboard Hooks in C#". I used it before and I personally always recommend it.
使用方法:
将 Gma.UserActivityMonitor
dll 的引用添加到您的项目中.
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...
这篇关于如何制作一个可以在按下 Enter 键时捕获所有点击的应用程序,但在我的 WinForm 中也是如此?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!