Saving in window mode..

Blitz3D Forums/Blitz3D Beginners Area/Saving in window mode..

po(Posted 2005) [#1]
I'm making a game that saves some Ints to a .dat file when the user presses Esc and ends the program. That works fine, but the game is in windowd mode and when the user clicks on the little X instead of pressing Esc, it doesn't run the code the saves before quitting. How can I save my game when you press the little X?
How I am saving the game:
While Not KeyHit(1)

Wend
SaveData()
End



cermit(Posted 2005) [#2]
I don't think it's possible to do anything about that with Blitz3D. Although with the AppTitle command you can warn the user.
Apptitle "My awesome game", "Hey Quitter! If you quit my game this way some
important data will be lost! Are you sure you want to quit this way?"



po(Posted 2005) [#3]
Man, i'm pretty sure I saw a command to make a warning pop if if you exited that way. I tried looking for it, but no luck.


Shambler(Posted 2005) [#4]
Cermit showed you it above ;)

http://www.blitzbasic.com/b3ddocs/command.php?name=AppTitle&ref=2d_a-z


po(Posted 2005) [#5]
OOOOhhhhhhh... heh. :)
I thought he was just setting the title as a warning.
Thanks.


cermit(Posted 2005) [#6]
Oh, i should have written it more clearly.


jfk EO-11110(Posted 2005) [#7]
This one will disable the close button completely:
http://www.blitzbasic.com/codearcs/codearcs.php?code=831

There was also a solution by Marcelo that allowed to detect Mouseclicks on the CLose Button and therefore would also allow to do some actions before ending the App, but it seems his Webspace is gone:
http://www.blitzbasic.com/codearcs/codearcs.php?code=832

I'll try to find someone who has the file...
EDIT: ok, found it, you can get it from here:
http://www.melog.ch/dl/blitzclose.zip , but read the example code ( http://www.blitzbasic.com/codearcs/codearcs.php?code=832 )


po(Posted 2005) [#8]
Cool, thanks.