views:

3877

answers:

2

I want to capture a keyboard shortcut in my application and trigger a dialog to appear if the user presses a keyboard combo even outside of the app. Similar to Google Desktop Search's Ctrl, Ctrl to bring up the search dialog.

I have tried using some keyboard hook modules out there that basically use Win32 interop to get this effect but each implementation I've tried ties down the keyboard to some extent to where you start getting weird behaviors when the application is doing something intensive. Such as loading a large amount of data, this would cause the keyboard and mouse to lockup.

I'm looking for a lightweight solution that would allow this to be done without tying down the keyboard and mouse.

+4  A: 

Stephen Toub wrote a great article on implementing global keyboard hooks in C#.

-John

John T
+2  A: 

If a global hotkey would suffice, then RegisterHotKey would do the trick

Joe