views:

108

answers:

2

My application resides mostly on the system tray on minimize. I'd like the user to be able to hit a keystroke (like ALT+SHIFT etc.) and it shows up on the screen (sort of like Launchy, if you've used it; or the Google search bar).

Anyone knows how to do it?

+2  A: 

You want the SetWindowsHookEx Windows API call. There is some details on using it in this CodeProject article:

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

There is also some useful advice about what will and won't work and what tricky issues lurk around SetWindowsHookEx and .NET here:

http://www.pinvoke.net/default.aspx/user32.SetWindowsHookEx

andynormancx
+2  A: 

The Managed Windows API has a Hotkey class that wraps the low-level hooking you want. Incredibly easy to use.

Matt Olenik
This seems very useful- hope I manage to use it correctly!
It's pretty foolproof. You make a Hotkey instance, set the keystrokes, enable it and you're receiving events.
Matt Olenik