Windows ALT-TAB

Started by
8 comments, last by Mythar 24 years ago
Hi all, dose anyone know how to desable Windows ALT-TAB.
Advertisement
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


__________________________________________

Yeah, sure... we are laughing WITH you ...
Isn''t there a flag used on DirectDraw creation that says something about ALT-TAB? I''ll check my code in about an hour.
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
Go to the MSDN:

http://support.microsoft.com/view/dev.asp?kb=243455

----------
Drago
osu!
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;
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
Thanx, for you replies
Hey PRISMA, try telling that to Team17 (mumbles incoherently about Worms: Armageddon).

This topic is closed to new replies.

Advertisement