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 中也是如此?
基础教程推荐
- 从 C# 控制相机设备 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 如果条件可以为空 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 将数据集转换为列表 2022-01-01
