简体   繁体   English

C#:是否可以监视来自外部Windows应用程序的按钮单击?

[英]C#: Is it possible to monitor button clicks from an external Windows application?

I would like to monitor button clicks in an external Windows Forms application from my own application. 我想从自己的应用程序监视外部Windows Forms应用程序中的按钮单击。

I have found examples that allow me to 'click' buttons in an external application (using Windows API), but this is not what I want to do. 我发现了一些示例,这些示例使我可以在外部应用程序中(使用Windows API)“单击”按钮,但这不是我想要的。

The reason for this is that I would like to do some logging on an external application that a company made for us. 原因是我想登录公司为我们制作的外部应用程序。 They are willing to program the logging into that application, but it is overly expensive. 他们愿意将登录程序编程到该应用程序中,但是这样做过于昂贵。

Can anyone help me with this? 谁能帮我这个?

Regards, Reinier 问候,雷尼尔

Usually this is done by installing a Windows hook. 通常,这是通过安装Windows挂钩完成的。 The API is SetWindowsHookEx (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx ). 该API是SetWindowsHookEx(请参见http://msdn.microsoft.com/zh-cn/library/windows/desktop/ms644990(v=vs.85).aspx )。 It's a really advanced task. 这是一项非常高级的任务。 The monitoring code can be implemented using .NET Framework and C# or VB.NET, but it would be better to use C or C++ for this. 可以使用.NET Framework和C#或VB.NET来实现监视代码,但是为此最好使用C或C ++。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM