Game Development Community

How to disable alt-f4?

by kcpdad · in Torque Game Engine · 05/24/2008 (5:46 am) · 3 replies

I would like to disable the windows OS windows shutdown command alt-f4 so a User can not exit the game that way. Has anyone added code to do this or know what needs to be do? thanks

About the author

Hobbyist working on a tank game when time allows. Play the prototype at => http://www.sytrept.com/60tons/


#1
05/24/2008 (6:09 am)
I don't think you can. I don't think that the Engine has anything to do with it's shutting down when you press alt+f4, I'm just going on a guess, but I'm fairly certain that when Windows receives the alt+f4 command, it ends the current program. The program doesn't exit itself, windows kills it.
#2
05/24/2008 (6:58 am)
You can trap it. I've been stuck in games that do that.
Bad idea, IMO.
#3
05/24/2008 (7:58 am)
Hey,
since i noticed some games actually doing this i decided to try and google for it...
this is the only thing i was able to find on the issue that had me confident that it might actually work..
if i was you i'd look into this solution by M.Hirsch using the WndProc:

http://forums.devshed.com/windows-help-34/disable-windows-shortcuts-56125.html

cheers.