How to get mouse/keyboard event from outside your form?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What kind of wizardry do I have to pull off so I can capture a mouse click
event or a key press event from OUTSIDE my form?

Ideally, with either case I also consume the event so that it does not reach
whatever app besides mine is currently in focus... but it's not totally
necessary if it's too much work.
 
Hello MrNobody,

You need to realize "global hooks".
See samples there
- http://www.codeproject.com/csharp/globalsystemhook.asp
- http://www.codeproject.com/csharp/globalhook.asp

M> What kind of wizardry do I have to pull off so I can capture a mouse
M> click event or a key press event from OUTSIDE my form?
M>
M> Ideally, with either case I also consume the event so that it does
M> not reach whatever app besides mine is currently in focus... but it's
M> not totally necessary if it's too much work.
M>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 
Back
Top