Question

How can i get the control (and possibly its text value) of a control which was clicked in another third party application (its not a .net or wpf application for which there are answers which did not solve my problem)

I can get the click event in my app (using the global hooks as mentioned here) i want the control/handle of that particular UI Element

Example : I have opened Notepad and when i click on File Menu, i want the control of that File button.

Was it helpful?

Solution

Look at the documentation for SetWindowsHookEx using the WH_CALLWNDPROC param. This will let you intercept messages in Notepad window procedure. You'll need to figure out which messages get generated from clicking the menu items in Notepad, you can use Spy++ for that. But there is no real control for the File button, it is part of a menu.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top