title: How to Detect The Clicked Control of a WPF App Outside the Application
body: <p>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: &quot;App1 - button3 is clicked.&quot; or &quot;App2 - button1 is clicked&quot;. If possible, I want to achieve this for both Winforms and WPF apps, but WPF is more important.</p>
  <ul>
  <li>Any way to do accomplish this in the background is OK.</li>
  <li>I tried examining and using source codes of <a href="https://github.com/snoopwpf/snoopwpf" rel="nofollow noreferrer">snoopwpf</a> (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)</li>
  <li>I looked a little into pywinauto module, however couldn't find such a functionality.</li>
  </ul>