获得另一个应用程序事件 [英] Getting events of another application
问题描述
在我的C#应用程序,我需要当用户点击来检测的不同,第三方应用两个按钮之一。
In my c# application I need to detect when a user clicks one of two buttons in a different, third party application.
我能够得到应用,但 MainWindowHandle
的句柄返回0。
I am able to get the Handle of the application but the MainWindowHandle
returns 0.
我试过的WndProc
但由于某些原因的事件将不会在我的应用火。
I tried WndProc
but for some reason the event will not fire in my application.
如何获得/截取从该应用程序的按钮单击事件到我的?
How can I get/intercept the button click event from that application into mine?
推荐答案
全局系统钩子使应用程序可以拦截针对其他应用程序的Windows消息。这一直是难以用C#实现。该项目于codePLEX试图通过建立在C语言的DLL包装,以实现全球体系挂钩++的消息发布到挂钩应用程序的消息队列中。简单地说,这可以让你实现任何类型的托管code全局的Windows钩子:的 HTTP://www.$c$cproject.com/KB/system/WilsonSystemGlobalHooks.aspx
Global system hooks allow an application to intercept Windows messages intended for other applications. This has always been difficult to implement in C#. This project on Codeplex attempts to implement global system hooks by creating a DLL wrapper in C++ that posts messages to the hooking application's message queue. Put simply, this lets you implement any type of global Windows hook from managed code: http://www.codeproject.com/KB/system/WilsonSystemGlobalHooks.aspx
这篇关于获得另一个应用程序事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!