How to use C# client to get information of clicked GUI element in another app?
-
10-10-2019 - |
Question
Can a C# client record all keyboard and mouse events using hooks and collect information on the clicked GUI element?
Which libary would you use?
Is Spy++ an option or would one need a C++ DLL for that?
Solution
It's better to do it in c++, you should register your hook, then you can create a bridge, but in C# may be Code project article is usefull.
OTHER TIPS
Check out Deskperience and their Screen Scraper Studio product. Offers you a trial with the SDK.
Im trying to emulate their functionality at the moment, but finding it hard to do as Im a one man show...
You have this lib, which is specially useful for managed apps. I'm not so sure how it interacts with non managed code though.
UISpy.exe is a tool using .net Automation Framework and will allow you to experiment with what you can automate in C#.
Along with lower level keyboard and mouse hooks as described by Paul Sasik in this question, you can translate the screen location into a .net automation object and gain additional info about what is being clicked or typed at.