Windows ALT-TAB
TO my knowledge, I don''t think you can. This quetions comes up every 2 weeks or so. No one has ever posted source code that actually works. That "make it think your game is a screen saver" trick doesn''t work. And I''ve never found a windows message you can intercept to stop ALT-TAB. shurg, maybe someone will finally post the correct method....
The solution regarding the screen saver doesn''t work as mentioned:
//: from help file ..
UINT nPreviousState;
// Disables task switching
SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
// Enables task switching
SystemParametersInfo (SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
..at least on my NT 4.0 machine.
However, there is an alternative solution that seems to work just fine:
//: sometime during window creation
RegisterHotKey(hwnd, 0x01, MOD_ALT, VK_TAB);
//: before app exits
UnregisterHotKey(hwnd, 0x01);
-mordell
Isn''t there a flag used on DirectDraw creation that says something about ALT-TAB? I''ll check my code in about an hour.
Well, I am sure there are ways to disable ALT-TABBING, but to tell you the truth, do you really want to? The whole purpose of windows is to allow multiple programs to run simultaneously. What if users need to ALT-TAB out of your app every so often (I know I have done it in the past). One other thing, is that if you ever plan to release a commercial app, wether it be a game or not, you must adhere to certain standards (set by MS and others), or else your app will be marked as incimpatable. You know that ''Designed for Windows x.x'' logo. You won''t get that unless you follow the standards.
Yeah, don''t disable it. I like this solution better!
case WM_ACTIVATEAPP:
is_active = (BOOL)wParam;
// see ya!
if(!is_active)
PostQuitMessage(0);
return 0;
case WM_ACTIVATEAPP:
is_active = (BOOL)wParam;
// see ya!
if(!is_active)
PostQuitMessage(0);
return 0;
Yes, it is better, if you don''t disable it, but there is a way of doing it... remove the WinMSG-stuff from your code (PeekMessage/TranslateMessage/DispatchMessage/...) and return 0 instead of msg.wParam. But Ctrl-Alt-Del will B disabled, too
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement