Handmade Hero»Forums»Code
Israel Fernández Angullo
16 posts
Win+d shortcut mistery
Hi!

While debugging my handmade engine the shortcut win+D stop working. Other windows shortcuts like win+e work as usual.
Do the win key should be avoided to prevent conflicts with the OS? or maybe is not the case?
I thought I understood how to handle window's input properly, but obviously that's not the case.
Why win+d don't work? Did I break something?
Can anyone explain or point me to an explanation about how or when windows shortcuts work?

Thanks!
Simon Anciaux
1337 posts
Win+d shortcut mistery
Have a look at RegisterHotKey and WM_HOTKEY.
Upon finding a match, the system posts the WM_HOTKEY message to the message queue of the window with which the hot key is associated. If the hot key is not associated with a window, then the WM_HOTKEY message is posted to the thread associated with the hot key.
Which I think means that W+D is processed by the "desktop window" and so the key messages are not sent to your window (or your window lost the focus so it doesn't get key messages anymore).

These keys are labeled with the Windows logo. Hotkeys that involve the Windows key are reserved for use by the operating system.
So it's probably not a good idea to use the windows keys for shortcuts.

In a small test on my machine (windows 7) when I try any windows shortcut (w+d, w+e, w+r, w+p...) my application only get the windows key messages, never the letters (using virtual keys or raw input).

Disable windows shortcut (not what you want but could help).
Israel Fernández Angullo
16 posts
Win+d shortcut mistery
Thank you very much for the links!
Disable windows shortcuts is really usefull! All the games using wasd and ctrl/alt should do it!

Again, thanks!
Mārtiņš Možeiko
2559 posts / 2 projects
Win+d shortcut mistery
Edited by Mārtiņš Možeiko on
I am actually very sad if standard windows shortcuts don't work for application or game. I like to use Alt+Tab to get out of game. Or just press Alt+F4 to quickly close it. Or use Ctrl+Shift+Esc to get to task manager if game hanged and I need to kill it. Disabling shortcuts would make some of these things impossible.
Simon Anciaux
1337 posts
Win+d shortcut mistery
The link above only disable the "windows logo keys" (not the shortcuts, just the keys), so other shortcuts should continue to work. And I agree that keeping alt + tab and ctrl + alt + esc is important. Adding Alt + f4 is a plus.

I encountered a game (I don't remember which one) that had an option that let the user disable the "windows keys". Maybe it's the way to go ?