3

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.

Fred
  • 3,324
  • 1
  • 19
  • 29
Pratik Bhattacharya
  • 3,596
  • 2
  • 32
  • 60
  • 4
    Sure, when you hold down the Shift key then the numpad keys generate a different code. NumPad0 becomes Insert. The state of the NumLock key matters too, so probably not a great choice for a hotkey. – Hans Passant Mar 10 '15 at 15:33

1 Answers1

2

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.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Pratik Bhattacharya
  • 3,596
  • 2
  • 32
  • 60