在另一个应用程序中处理按钮单击 [英] Handle button click in another application

查看:22
本文介绍了在另一个应用程序中处理按钮单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种获取按钮按下事件的方法,类似于 this 用于在事件触发后立即检索指针.我的意思是按钮位于我设置为目标的任何特定 Windows 应用程序上(例如 Windows 媒体播放器的播放按钮).如果您知道在我单击播放"按钮后立即捕捉什么消息.

I am looking for a method to get a button press event, something similar like this which is used to retrieve a pointer right after an event is fired. The button I mean is located on any particular windows application I set as a target (.eg windows media player's Play button). If you know what message to catch right after I click the Play button.

推荐答案

您正在寻找的是 Global Mouse Hook.你可以看看这篇文章:在C#中处理全局鼠标和键盘钩子

What you are looking for is Global Mouse Hook. You can take a look at this article: Processing Global Mouse and Keyboard Hooks in C#

处理 CLICK 事件后,您可以使用 API 函数获取光标下的应用程序/控件(WindowFromPoint).

Once you handle CLICK event, you can use API functions to get Application / Control under the cursor (WindowFromPoint).

这里还有一篇包含代码示例的文章,可以帮助您:.NET Object Spy 和InvokeRemote(这个类似于spy++)

Here is one more article with code sample that will help you: .NET Object Spy and InvokeRemote (this is similar to spy++)

如果不使用 Windows 本机方法,您就无法做到这一点.

You cannot do this without using windows native methods.

这篇关于在另一个应用程序中处理按钮单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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