views:

218

answers:

2

An example of an app that does this is Enso, it pops up when you press the caps lock.

A: 

You need to install a hook in user32.dll. Lookup the Win32-API call SetWindowsHookEx. You can call it from C# via the stuff in System.Runtime.InteropServices.

This article discusses the topic nicely.

Edit: Lars Truijens answer looks like a nicer approach actually.

Maximilian
+3  A: 

You can act on global hotkeys by calling the winapi function RegisterHotKey. Also see http://www.codeproject.com/KB/vb/mclhotkeynet.aspx and http://www.codeproject.com/KB/miscctrl/systemhotkey.aspx for example. You can not use all key combination as hotkeys. For those that don't work you might try a global keyboard hook (SetWindowsHookEx)

Lars Truijens