问题
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