How to make an application that can capture all click when you press the Enter key, but in my WinForm as well?(如何制作一个可以在按下 Enter 键时捕获所有点击的应用程序,但在我的 WinForm 中也是如此?)
问题描述
我尝试开发一个应用程序,该应用程序在所有鼠标单击时都制作屏幕截图,当我按下输入"键以制作教程时,但我看不到如何在我的应用程序之外捕获这些事件.我怎么能这样做???
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 中也是如此?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何制作一个可以在按下 Enter 键时捕获所有点击的应用程序,但在我的 WinForm 中也是如此?
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
