[Solved] Hotkey failure

Windows specific forum
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

[Solved] Hotkey failure

Post 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
Last edited by BarryG on Fri Jan 27, 2023 12:34 pm, edited 1 time in total.
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: Hotkey failure

Post 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.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Hotkey failure

Post 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!
Post Reply