c# - Trying to detect and gather data on click outside application
问题描述
I would like to know if it is possible to, while running a WPF window application in Visual Studio, wait for the user to click anywhere on the screen (not necessarily inside the window of my application - for the purpose of my application, the click would most likely occur inside a browser page) and then gather the information about the click (like inside the window of which application the user clicked, or the selector of the html element the user clicked)? I know this question might be very confunsing but this is basically my last resort since researching on the Internet hasn't helped me much. Just to provide a better idea of what I seek, it's like what the 'Extract Structured Data' Activity does in UiPath. Oh and I'm using C# by the way.
解决方案
您可以尝试使用这个名为GlobalMouseHook的外部库。
即使应用程序处于非活动状态并在后台运行,该库也允许您点击键盘和鼠标,检测并记录它们的活动。
这是您可以使用此库执行的操作:
- 鼠标坐标
- 单击鼠标按钮
- 鼠标拖动动作
- 鼠标滚轮滚动
- 按键和释放
- 特殊键状态
希望这可以帮助。
推荐阅读
- vaadin - 如何在此页面上找到 Font Awesome 的哪个版本?
- css - 为什么我不能覆盖线性渐变?
- node.js - 如何在 NodeJS 中解析 MongoDB 文档字符串
- r - 如何在 docker 中在 Rscript 上运行“write.csv”?
- command-line - 命令行问题.. 我最近使用 start atom filename.txt 从命令行打开 atom 中的文件
- batch-file - 为什么我的任务会杀死而我的 while 循环不起作用?
- javascript - Jquery/Javascript:比较两个下拉最小值和最大值?
- scala - 在 kafka 中处理大型 Xml 文件
- office-js - 如何从 office js excel 插件内部向 HTTP 服务器发出 post 请求?
- java - Univocity-parsers FixedWidth 解析,每行有多个记录