Responding to global keyboard shortcuts

  • Thread starter Thread starter Klaus Jensen
  • Start date Start date
K

Klaus Jensen

Hi!

I have developed an app, which normally resides in the tray and does stuff
in the background. I would like to make it possible to press a keyboard
shortcut from anywhere in windows/applications and respond to that event.

I have searched high and low on the web, but I guess I do not know excatly
what to look for. :)

Could someone please point me in the direction of an answer? :)

- Klaus Jensen
 
I have no idea how to do it in .Net, but in Win32 you need to call
SetWindowsHookEx(WH_KEYBOARD, ...) and pass it your own KeyboardProc that
will be called on keyboard events.

Jerry
 
Hey Klaus

I have previously used a modified version of the MCL .net system-wide hotkey component (http://www.merrioncomputing.com/Download/index.htm). This component uses P/Invoke to call the Win32 API function RegisterHotKey. The component contains a few bugs which I have corrected (e.g. it starts "polling" every second after the hotkey has been pressed once and also it does not delete previously registered hotkeys).

Feel free to contact me if you would me to send you the corrected version

Regards, Jakob.
 
Back
Top