catch key event ,system tray

gh9090

New member
Joined
Oct 13, 2009
Messages
4
Programming Experience
Beginner
How do catch key event (short cut keys like alt+d,Ctrl+u) when a program running in system tray ?;)
 
Any time that your form doesn't have focus you can't trap key presses using the usual means. You need to register a hotkey with the OS, which will then notify your app when that key is pressed. You should use more unusual key combinations to lessen the likelihood of clashing with other apps. ALWAYS use at least two modifier keys for a start.

The Windows API functions you need to use a RegisterHotkey and UnregisterHotkey. Do a web search and you'll find explanations and examples.
 
Back
Top