tags:

views:

137

answers:

3
+1  Q: 

Low-level Keyhook

I would like to run a low-level keyhook on a seperate thread in C# to detect for certain hotkeys. How would I do this?

+1  A: 

You could use this library :

http://www.codeproject.com/KB/system/globalsystemhook.aspx

Thomas Levesque
+1  A: 

You can to use DirectX. Add a reference to Microsoft.DirectX.DirectInput (after you've installed directX on your machine. Here is the SDK.)

Create an instance of the device class:

keyboard = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Keyboard);

And you can now listen to the keyboard.

sagie
+3  A: 

If you need this keyboard hook only to detect hot keys then you should not use a hook. Windows supports hot keys with the RegisterHotKey() API function. Check my code sample in this thread to see how to use it. There's a C# sample further down the page.

Hans Passant