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?

Was it helpful?

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

Yes you can. See here and here. It's called event hooking.

You don't need any special library. Also, Spy++ is a standalone app that does this. Are you looking to write something like it with .NET?

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...

Link to Deskperience Website

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.

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