Skip to main content
GameDev.net gamedev.net
🔒 Locked

disabling ALT+TAB

Started by Mescalito Feb 9, 2004 at 5:57 PM 33 replies 6.2k views
Original Post
Mescalito
Mescalito
Hi all ! that''s quite simple, i''d like to know how to disbale the ALT+TAB key combination under Win32. I tries some things such as accelerators but no results were made...So do you have any solution ??? Thanks
psykr
psykr
Why do you want to disable Alt-Tab? It''s never a very good idea.
alnite
alnite
yup. in case your game crashes for various reasons, you are fux0red. Also players can''t switch between their running apps and your game.
brassfish89
brassfish89
There is atleast 1 thread like this every month. Google. Search this forum. Atleast try to solve it yourself!! It sickens me how lazy people are these days.
Mescalito
Mescalito
thanks for awswers.

brassfish you makes me laugh

so there''s no real solution as it seems ?
Flax
Flax
quote:

You cannot disable Alt-Tab. Windows is a pre-emptive OS and having an application disable that would destroy the feature of the OS (if you could deactivate Alt-Tab, we would degenerate to cooperative multitasking just like Windows 3.1 had).


I''m pretty sure you can disable alt tab, try running a Quake 3 dedicated server and alt tab stops working. However I don''t know how you''d do it.
EDI
EDI
Alt-Tab, is a system function, users expect that it should work and thus you shouldn't disable it,

if this is a case about DirectDraw surface loss,

to quote a document released by ms.

Q: How do I disable Alt-Tab?

A: You don't, really.

But, there are a few ways you can handle it, some people have told me that WM_ACTIVATE can be used to detect a 'switch-away' before it can reset the display and trash volitile vram surfaces so you can try that(i havent been able to make it work reliably though) the other option is to keep an SRAM copy of your vram surfaces, that way when they are lost you can blt them back. if you never change the contence of these surfaces then you can just load them back from file if you wish too. A good place to determine a surface-lost condition is to check the return value of the DirectDrawSurface::Flip method, if it returns DDERR_SURFACELOST then it means the primary or backbuffer surfaces have been lost, when, in this event you can attempt to Restore the surface(s) when the restoration works you can begin to restore all of your lost surfaces, be sure to do an IsLost test on all surfaces(unless you have a way of knowing which ones are vram, then only test them) you can use use one of the methods mentioned above.

Other than that i cant see why you would want to disable alt-tab, doing so breaks the concept of a uniform interface between all applications.

Raymond Jacobs,

www.EDIGames.com

www.EtherealDarkness.com



[edited by - EDI on February 10, 2004 4:13:14 PM]

[edited by - EDI on February 10, 2004 4:17:43 PM]
DaJudge
DaJudge
I believe this is a real problem in Windows (and other multitaskin OSs). It''s perfectly valid to have a game that should handle the Alt+Tab combination itself instead of having windows switch to another task. Say you have a ego shooter where you have Alt for shooting and shift for going fast (okay, better combinations exist, but it''s valid)... So there you have it.
Don''t get me wrong. I also do have the opinion that you shouldn''t disable system-hotkeys at all, but I think that there are valid reasons to do. So it''s basically a problem of the underlying OS that is not able to provide the services demanded by the user...

Just my 2 cents,
Alex
Alexander Stockinger
Programmer
Stonicus
Stonicus
The guy didn''t ask if it is a good idea or not, just how to do it. Answer the question or don''t get involved.

As for googling for the answer, all you get is a ton of replies "Why do you want to disable ALT-TAB??" Does questioning people''s motives make you feel smarter or something?


TangentZ
TangentZ
quote:
Original post by Stonicus
The guy didn''t ask if it is a good idea or not, just how to do it. Answer the question or don''t get involved.



The OP''s question *IS* answered.

DO NOT DO IT. FORGET IT. IT''S STUPID.

That is the answer.



Kami no Itte ga ore ni zettai naru!
神はサイコロを振らない!
Stonicus
Stonicus
quote:
Original post by tangentz
quote:
Original post by Stonicus
The guy didn''t ask if it is a good idea or not, just how to do it. Answer the question or don''t get involved.



The OP''s question *IS* answered.

DO NOT DO IT. FORGET IT. IT''S STUPID.

That is the answer.



Kami no Itte ga ore ni zettai naru!


So what you''re really saying is that you don''t know how to do it.
Stonicus
Stonicus
quote:
It shouldnt be done, so who cares.

your program is in the os''s house and needs to obey the rules.


I care, and it is screaming to be done!


TangentZ
TangentZ
quote:
Original post by Stonicus
So what you''re really saying is that you don''t know how to do it.



Nope. And you''re not "answering the question", either.

As you said:

quote:
Answer the question or don''t get involved.




Kami no Itte ga ore ni zettai naru!
神はサイコロを振らない!
Stonicus
Stonicus
quote:
Original post by tangentz
quote:
Original post by Stonicus
So what you're really saying is that you don't know how to do it.



Nope. And you're not "answering the question", either.

As you said:

quote:
Answer the question or don't get involved.




Kami no Itte ga ore ni zettai naru!


SystemParametersInfo(SPI_SCREENSAVERRUNNING, ....)
This parameter will disable ALT-TAB, CTRL-ALT-DEL, CTRL-ESC, and I think ALT-F4... look at the MSDN for the rest of the params needed... But, if your program breaks you are screwed... you will need to reboot...


[edited by - stonicus on February 10, 2004 5:07:08 PM]
Raloth
Raloth
I have played a game where I inadvertently set alt to some movement type and tab for a special shot, and every time I tried to combine them...oops! I had to change my key configuration around it. It would have been really nice to have an option to disable alt+tab and move it to a different key sequence.

There are 2 ways to do it:

1) Write a keyhook.
2) Subclass your window and stop the message before it gets anywhere.

I will force you to actually use that search button and get you out of your laziness if you want more information.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
RapidStunna
RapidStunna
quote:
It shouldnt be done, so who cares.


I care, not because I plan on using it, but because I always am willing to extend my programming knowledge - you don't?

So what Stonicus said, SystemParametersInfo is the function that will do it. You have to fake the system into thinking that the screen saver is on in which case, it disables the management key combos.

[edited by - RapidStunna on February 10, 2004 5:43:18 PM]
ShawnO
ShawnO
quote:
Original post by Mescalito
thanks for awswers.

brassfish you makes me laugh

so there''s no real solution as it seems ?


Like brassfish said, a little effort put into a search before posting would likely have answered your question.

http://www.gamedev.net/community/forums/topic.asp?topic_id=155473

The last post in that thread is mine, where I describe installing a CBT hook to prevent users from ALT-Tabbing out of your program. I believe that a CBT hook is the most proper way to accomplish this under Windows.

Shawn
When using the Windows calculator program, always remember to clear any values from memory before exiting to prevent burn-in.
CGameProgrammer
CGameProgrammer
This is like asking "How do I cause the computer to reboot?" Disabling Alt+Tab, as many have said, is never a good idea. If the command gets in your way, redesign your UI.

~CGameProgrammer( );

Screenshots of your games or desktop captures -- Post screenshots of your projects. There''s already 134 screenshot posts.
~CGameProgrammer( ); Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
RdF
RdF
I''d vote for a windows hook, the only thing you can''t block AFAIK is the CTRL-ALT-DELETE combination. Whats more you can spawn it off in a separate thread or launcher app and remove the hooks if the game crashes.

Loss of ATL-TAB won''t stuff you up too bad but no task manager would be a real big pain.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.