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 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
2010-02-03 12:39:43
+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
2010-02-03 13:16:54