Getting events of another application

隐身守侯 提交于 2019-12-19 10:44:11

问题


In my c# application I need to detect when a user clicks one of two buttons in a different, third party application.

I am able to get the Handle of the application but the MainWindowHandle returns 0.

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?


回答1:


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



来源:https://stackoverflow.com/questions/7904544/getting-events-of-another-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!