This function defines a system-wide hot key.
BOOL RegisterHotKey( HWND hWnd, int id, UINT fsModifiers, UINT vk );
[in] Handle to the window that will receive WM_HOTKEY messages generated by the hot key. The value of this parameter should not be NULL.
[in] Identifier of the hot key. No other hot key in the calling thread should have the same identifier. An application must specify a value in the range 0x0000 through 0xBFFF. A shared dynamic-link library (DLL) must specify a value in the range 0xC000 through 0xFFFF.
[in] Specifies keys that must be pressed in combination with the key specified by the nVirtKey parameter in order to generate a WM_HOTKEY message. The fsModifiers parameter can be a combination of the following values.
Either ALT key must be held down.
Either CTRL key must be held down.
Both key up events and key down events generate a WM_HOTKEY message.
Either SHIFT key must be held down.
Either WINDOWS key was held down. These keys are labeled with the Microsoft Windows logo.
[in] Specifies the virtual-key code of the hot key.
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
When a key is pressed, the system looks for a match against all hot keys. Upon finding a match, the system posts the WM_HOTKEY message to the message queue of the thread that registered the hot key. This message is posted to the beginning of the queue so it is removed by the next iteration of the message loop.
RegisterHotKey can be used to register hot keys across threads.
RegisterHotKey fails if the keystrokes specified for the hot key have already been registered by another hot key.
If the window identified by the hWnd parameter already registered a hot key with the same identifier as that specified by the id parameter, the new values for the fsModifiers and vk parameters replace the previously specified values for these parameters.