get desktop key and mouse events (not only the Form ones)

  • Thread starter Thread starter carvalho.miguel
  • Start date Start date
C

carvalho.miguel

hi,
is there a way i can get the mouse events (click, move, etc) and
keyboard events (key pressed, etc) from the entire desktop (not only
from the focused window) ?

my form is hidden, so it doesnt get any events, but id like to know
when the user is using the mouse/keyboard.

maybe using p/invoke to some win32 api function for that purpose? just
point me the way
thanks in advance =)
 
You would need to hook into windows events. There are plenty of sites showing
you how to do keystroke loggers and the like although they aren't always nice
sites as there arent many good/legal uses for such software.

Ciaran O'Donnell
 
You would need to hook into windows events. There are plenty of sites showing
you how to do keystroke loggers and the like although they aren't always nice
sites as there arent many good/legal uses for such software.

Ciaran O'Donnell

im building an exposé ( www.apple.com/macosx/features/expose ) like
application for .NET/Mono, using a maximized form and .Opacity member
for the fade in/out effect just for the fun of it. and the need to get
keyboard/mouse input is so i can see if the user is using the computer
or not, and in case he is the effect stops, so no need to worry about
ilegal/bad use of such feature :p

ill check message hooking on google, thx for the reply =)
 
Hi,

what you are looking for is installing a windows hook.
You can use .NET to install only few types of hooks. WH_KEYBOARD_LL and
WH_MOUSE_LL are one of them. However you need to use PInvoke for that.

I believe if you google you can find sample code how to do that. You can
start for example here

http://www.codeproject.com/csharp/globalhook.asp
 
Back
Top