0

This might be a common question but I've been searching for almost 30 minutes, and couldn't find what I've been looking for.

In a windows forms application I need to capture the mouse click event both on and outside of the current form. But all the click events that I've come across are attached to the controls, hence when I click outside of the form no event is being fired :/

I am guessing there is a static Mouse object somewhere and I should be able to get the mouse click position maybe?

Zong
  • 6,160
  • 5
  • 32
  • 46
Tolga Evcimen
  • 7,112
  • 11
  • 58
  • 91

1 Answers1

1

This is often referred as global mouse hook.

Here's an example: http://www.codeproject.com/Articles/7294/Processing-Global-Mouse-and-Keyboard-Hooks-in-C

The associated project on codeplex: http://globalmousekeyhook.codeplex.com/

ken2k
  • 48,145
  • 10
  • 116
  • 176