views:

519

answers:

2

How can I hook an application so that I can find out when the mouse is double clicked within it?

Can this be done in .NET?

Are there anythings I should be careful about? (crashing the other application, for instance)

A: 

It can be done in .NET, using the Win32 API. This MSDN article describes windows hooks. There is also this at CodeProject.

And yes, you should be very careful to always unhook handlers, no matter what error condition could cause the application to close unexpectedly.

Mitch Wheat
+2  A: 

The article "How to inject a managed .NET assembly into a managed process" will give you all you need to know to set the hook.

The article "How I Built a Working Poker Bot: Part 4" will give you all you need for capturing the double clicks.

The code for both articles can be fairly domain specific, but you shouldn't have much trouble pulling out the golden nuggets to get up and running.

Gavin Miller