Capturing Windows Keys and Mouse Movements

  • Thread starter Thread starter Jonny
  • Start date Start date
J

Jonny

Hi all,

Does anyone know how to capture the Windows Keys (I know
that they are out of the ascii key range) and how to
capture and record Mouse movements?

Thanks,

/Jonny
 
Jonny,

If you need to do this for the entire system, then you need to set up
hooks into the system. In order to do this, you will have to call the
SetWindowsHookEx API function through the P/Invoke layer. However, if you
need to do it just for your application, then I recommend implementing the
IMessageFilter interface, and passing an instance to the static
AddMessageFilter method on the Application class. This will allow you to
process all the windows messages that go to your app before your app handles
them. You can then filter out the keyboard and mouse messages that you want
to handle.

Hope this helps.
 
Back
Top