How to Detect The Clicked Control of a WPF App Outside the Application

313 views Asked by At

Scenario: I have one more more WPF applications opened. I cannot change the source code of these apps. My purpose is Whenever user clicks any control (button, combobox, textbox etc.) on these apps, I want to know which control / element is clicked, and log it. Simply obtaining the name of the element would be enough like so: "App1 - button3 is clicked." or "App2 - button1 is clicked". If possible, I want to achieve this for both Winforms and WPF apps, but WPF is more important.

  • Any way to do accomplish this in the background is OK.
  • I tried examining and using source codes of snoopwpf (Since it is able to detect the element under the mouse cursor by pressing CTRL+SHIFT), but I wasn't able to achieve my purpose. I could not get the elements in different AppDomains. (AppDomainHelper.GetAppDomains() also returns null)
  • I looked a little into pywinauto module, however couldn't find such a functionality.
0

There are 0 answers