Advertisement

Alt+Tab

Started by February 06, 2003 09:08 PM
7 comments, last by Inpho 21 years, 9 months ago
Im sure this has been asked before, but for my console game, it opens up full screen.. And was just wondering how I can lock the Alt+Tab?? or alt+f4..if thats possible. thanks, Inpho
This must be a easy question, someone help me out please..
Advertisement
I know how to do it in a win32 application, but not in a win32 console project sorry.

I am not sure that you can do that in a console, because you need to be able to intercept the WM_CLOSE message for alt + f4 and for alt+tab you need to intercept a few(WM_ACTIVATE I think and another).

Later,


Michael Bartman
Michael BartmanLead ProgrammerDark Omen Studios
You can''t intercept Alt+Tab in a console application.

However, you can intercept Alt-F4 using SetConsoleCtrlHandler(). You set up a handler that looks for CTRL_CLOSE_EVENT events and returns TRUE when found. That causes a pop-up that asks the user if they want to terminate or not.

Unfortunately, there''s no way to avoid the pop-up...

Ahh, Ok thank you for your help..
Why do you want to make your app more annoying for the user? I sometimes find that when playing a game, I want to stop (or start) Winamp or ICQ. Should I have to quit the game first?

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Advertisement
Just for my personal knowledge ..
Diableing the Alt+Tab key is sometimes necessary to ensure the security of the application. Take a MMORPG, by letting the user Alt+Tab you allow the user to stop his client, while the world continues. This causes a sync problem. It also allows a user to run a false app that send commands directly to the server and in some instances cheat. I''m not saying that disiabling the Alt+Tab key is a good solution for this, as I have hated not being able to drop out of a game to reply to am message or mess with winamp, I am mearly giving an example of it''s use.

BW
The solution to this problem (MMORPG) is simply to freeze the application and have the message sent that the application is doing so. This to avoid cheating. This is really up to the designer of course. Yes, you can argue about icq popping up etc... but as a developer you can have it as a requirement that these things should be turned off. I know plenty cases where people have msn running planning things together (cheating) in all kinds of games so this is a real problem that should be adressed. In my own API the freeze is built in(currently), so what if it is an annoyance, that is nothing compared to how those who have cheating players against them feel. I am actually going to build in functions that can see if you have these things running and give the opportunity to quit the application. (Of course this should be a developers choice but this is how I feel about it) Actually I would like to hear about how others feel about this any any ideas/suggestions you might have. But please do that at my own forum at www.planetrift.com. As for the ALT-TAB issue you can avoid it by changing the values in the registry but this is highly adviced against since on an NT/XP machine this can cause the problem of not being able to log on to a machine again. The ALT-TAB is a safeguard to shut down buggy applications if possible.

____________________________________________________________
Try RealityRift at www.planetrift.com
Feel free to comment, object, laugh at or agree to this. I won't engage in flaming because of what I have said.
I could be wrong or right but the ideas are mine.




[edited by - MichaelT on February 7, 2003 3:37:21 PM]
No no no no! :)

This topic is closed to new replies.

Advertisement