0

I'm trying to write a WinForms program that will capture mouse coordinates upon pressing and (more importantly) releasing the middle mouse button.

My form has topmost set to true (so that text in it can always be visible even when it doesn't have focus).

What I'm aiming for is being able to hover the mouse over a game window after my program starts, hit the middle mouse button, and have it record the mouse position for later use.

I can get it to detect when the middle mouse button is clicked inside the form using the MouseUp event (bound to the form itself) but have no clue what I need to do to have it detect when the mid mouse is clicked outside my form.

Thanks for any help guys.

Tyler W
  • 472
  • 1
  • 6
  • 21
  • possible duplicate of [Capturing mouse/keyboard events outside of form (app running in background)](http://stackoverflow.com/questions/3312752/capturing-mouse-keyboard-events-outside-of-form-app-running-in-background) – Hans Passant Dec 22 '11 at 00:52

1 Answers1

0

I believe what you are after are called low level hooks. A quick google brings up this: Erroneous Mouse Coordinates Returned from Low Level Mouse Hook C#

A microsoft example of how to do can be found here: http://support.microsoft.com/kb/318804

Community
  • 1
  • 1
Dessus
  • 2,147
  • 1
  • 14
  • 24