Search code examples
c#user32registerhotkeyglobal-hotkeynumpad

Using RegisterHotKey to register hot key using Numpad


I have used RegisterHotKey for registering a global hotkey for my application. I need to register Control + Shift + 0 (in numpad) for the application. I have registered it using the below code snippet:

RegisterHotKey(_mainWindowHandle, 1, (uint)ModifierKeys.Control | (uint)ModifierKeys.Shift | 0X4000, (uint)Keys.NumPad0);

However it not responding as expected, other hotkeys are getting registered, only the above combination is not responding.


Solution

  • Shift + Numpad generated a different code, hence Ctrl+Shft+Numpad was not producing expected result. I found a workaround by changing the shortcut from Ctrl+Shift+Numpad to Ctrl+Numpad.