Windows – How to register a custom keyboard shortcut for a windows application

keyboard shortcutsregistrywindows

I want to create a windows utility application, which can be called anytime from within any other application using a keyboard shortcut, e.g.:

Win + T

Ctrl + T

Alt + T

Ctrl + Alt + T

Ctrl + Shift + T

What key combinations can I use and how to setup those in the windows registry?

(If the shortcut is used by an other application, it should of course not work.)

Best Answer

An option for doing that programatically when your application start is calling this Windows API:

RegisterHotKey(IntPtr hwnd, int id, int fsModifiers, int vk);

And to unregister call this API:

UnregisterHotKey(IntPtr hwnd, int id);

Both exist in user32 APIs

http://www.pinvoke.net/search.aspx?search=RegisterHotKey&namespace=[All]