ShortcutGadget winkey support

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

ShortcutGadget winkey support

Post by Rinzwind »

Any chance to add support for the winkey combinations? Any reason it is not detected? RegisterHotKey supports it (with some practical limitations with lower level workarounds). #PB_Shortcut_LeftWindows

https://docs.microsoft.com/en-us/window ... sterhotkey
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: ShortcutGadget winkey support

Post by BarryG »

I'm guessing it's not supported (by Microsoft, not PureBasic) because pressing it opens the Start menu; whereas setting it with RegisterHotKey is possible because you're not actually pressing it when registering it.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: ShortcutGadget winkey support

Post by Rinzwind »

RegisterHotKey_ works fine when combined with second hotkey and not yet taken, CTRL+WIN+I for example.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: ShortcutGadget winkey support

Post by BarryG »

Rinzwind wrote: Mon Sep 27, 2021 10:31 amRegisterHotKey_ works fine
For the reasons I already said - because it's not being pressed to register it. You can't register it with the hotkey control because pressing the key takes the focus away from the control to show the Start menu.
Last edited by BarryG on Mon Sep 27, 2021 10:57 am, edited 1 time in total.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: ShortcutGadget winkey support

Post by Rinzwind »

I don't follow. It works. Win+ctrl+I can be catched in a PB program without low level hooks, same as any other shortcut. Start menu does not popup. So it should be added to the shortcutgadget.

Start menu only popups when only the win key is pressed/depressed. Not when any key is added at the same time. Otherwise win+e wouldn't work to open explorer and a dozen other shortcuts...
Last edited by Rinzwind on Mon Sep 27, 2021 11:00 am, edited 1 time in total.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: ShortcutGadget winkey support

Post by BarryG »

The very act of pressing the Windows key takes the focus away from your app... that's what I'm trying to explain. So the control never gets to see the Windows key and register it as a shortcut. On the other hand, RegisterHotKey_() works because you're not pressing the Windows key to register it - you're programmatically telling it to use the Windows key.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: ShortcutGadget winkey support

Post by Rinzwind »

That only happens when the shortcut is already registered and does something. One can press CTRL+WIN+I in the shortcutgadget and it keeps focus, it just doesn't recognize it (shows CTRL+I)...
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: ShortcutGadget winkey support

Post by BarryG »

Okay, so that just proves the Windows key isn't supported by the control (which is just the Windows "msctls_hotkey32" control). Fred can't change that.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: ShortcutGadget winkey support

Post by Rinzwind »

Should be fixed by creating an improved one then... can't always rely on native unmaintained controls.

Manual reads: "The initial shortcut to display. The possible values are the same as in the AddKeyboardShortcut() function. "
Which includes "
#PB_Shortcut_LeftWindows
#PB_Shortcut_RightWindows
#PB_Shortcut_Command
"

The gadget is not Windows 95+ aware ;)

That was the solution elsewhere too when people complained about its age-old limitations.
Post Reply