View Full Version : How to Disable WinKey
03-12-2003, 01:22 PM
I'm trying out the Full-Screen mode with OpenGL for the first time and I was wondering if there is any way to disable the Windows 'Start' menu when pressing the Windows Key (or WinKey or Start Button) on the keyboard.
In case this has been answered a thousand times in the forum, I apologise.
03-12-2003, 02:06 PM
Depends on what you are programming in... console, win32, MFC, glut, etc. But basically the virtual key codes for the Windows logo keys are VK_LWIN (left logo key) and VK_RWIN (right logo key) and VK_APPS (menu shortcut key).
When you have a keydown event, you should be able to test for those codes and just return from the function rather than processing it. Should be simple enough.
03-12-2003, 11:42 PM
I don't remember specifically about the windows key, but there are some special "system key" combinations (such as ALT+TAB) that can not be handled by just trapping them in the window event callback function. The solution is different depending on if you are running Windows 9x/ME or NT/2k/XP:
9x/ME: Fool Windows into believeing that a screensaver is running.
NT/2k/XP: Set up a low level keyboard hook that traps undesired system keys.
For complete code etc, see the GLFW (http://hem.passagen.se/opengl/glfw) source code (in file lib\win32\win32_enable.c). The simplest soulution is of course to use GLFW instead, then you only have to call:
glfwDisable( GLFW_SYSTEM_KEYS );
...or better yet: rely on how GLFW handles these keys/events (e.g. by iconifying your fullscreen window if it is inactivated as a result of ALT+TAB).
Also, GLFW has pretty darn advanced keyboard handling (check lib\win32\win32_window.c).
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.