Page 1 of 1

[Solved] Hotkey failure

Posted: Fri Jan 27, 2023 10:44 am
by BarryG
One of my users emailed me to ask why they can't use Shift+Ctrl+Numpad1 for a hotkey (my app lets them specify their hotkeys).

And guess what; they're right! Why isn't this working, despite RegisterHotKey_() returning success? It doesn't work in a callback, either.

Is it a bug, or a Windows (OS) limitation? It works if I use just Ctrl+Numpad1, so Shift seems to stop it? Why 1 for success, then?

Code: Select all

OpenWindow(0,400,200,640,240,"test",#PB_Window_SystemMenu)
Debug RegisterHotKey_(WindowID(0),0,#MOD_SHIFT|#MOD_CONTROL,#VK_NUMPAD1) ; Returns 1 (success)
Repeat
  ev=WaitWindowEvent()
  If ev=#WM_HOTKEY
    Debug "this is never seen"
  EndIf
Until ev=#PB_Event_CloseWindow

Re: Hotkey failure

Posted: Fri Jan 27, 2023 11:25 am
by nsstudios
Interesting!

Googling the issue, I ran into this dev blog article which says that shift bypasses numpad.
There's this GitHub issue as well.

Re: Hotkey failure

Posted: Fri Jan 27, 2023 12:32 pm
by BarryG
Ah, thanks for that. That led me to also find this -> https://stackoverflow.com/questions/533 ... ft-numpad1

So I'll have to amend my app to not accept Shift with any NumPad keys. Strange that RegisterHotKey_() returns 1 for success, though. Misleading!