1

I am trying to write an application that would listen for events outside of my application in C# but I'm having a lot of trouble finding any information about this. The idea is to listen for a click or a focus change and at a specific time get some information about the control that the user is interacting with. I would want information such as the accessibilityID, control type, name, tree structure for that element, and any other information that might be relevant. I would like to build something like Inspect. I would then take the data and do different manipulations on it later.

Being a bit new to C# I'm not sure exactly where to look. I imagine that there should be some sort of event that would give me the information I need but I can't find it. If anyone could point me in the right direction I would really appreciate it.

FuegoFingers
  • 2,181
  • 6
  • 27
  • 36
  • 1
    Check out the [System.Windows.Automation namespace](http://msdn.microsoft.com/en-us/library/system.windows.automation(v=vs.110).aspx). – Raymond Chen Jan 10 '14 at 17:08
  • 1
    Check out [UI Automation Using MSAA](http://www.codeproject.com/Articles/38906/UI-Automation-Using-Microsoft-Active-Accessibility) to get more links/ideas. – Alexei Levenkov Jan 10 '14 at 17:08
  • 1
    An example tracking focus changes: http://stackoverflow.com/a/11712947/517852 – Mike Zboray Jan 10 '14 at 17:19

1 Answers1

1

You are most likely going to need to hook into low-level Window events...

http://msdn.microsoft.com/en-us/library/windows/desktop/dd373889%28v=vs.85%29.aspx

xspydr
  • 3,030
  • 3
  • 31
  • 49