如何制作一个可以在按下 Enter 键时捕获所有点击的应用程序,但在我的 WinForm 中也是如此? [英] How to make an application that can capture all click when you press the Enter key, but in my WinForm as well?

查看:20
本文介绍了如何制作一个可以在按下 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 中也是如此?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆