Closing and opening a file

Blitz3D Forums/Blitz3D Programming/Closing and opening a file

Nexic(Posted 2004) [#1]
I need my game to exit and load another program. However, if I do this:

Execute "blah blah.exe"
Exit

The game stays in the task bar and doesnt close until you open it up again. This looks rather messy. If of course you exit first it never actually executes the program. Does anyone know a way around this?


semar(Posted 2004) [#2]
You may use End instead of Exit. Exit is used to quit prematurely a loop like while..wend or for..next or Do..Forever.

The Exit command won't work if outside of a loop.

The Execute command is not a valid statement in Blitz command reference. Use ExecFile instead.

ExecFile "calc.exe"
End
The above code will start the windows calculator, and quits. The calculator application remains active and running.

Hope this has sense for you,
Sergio.


Yan(Posted 2004) [#3]
If you're in graphics mode (2D or 3D) you'll need an EndGraphics command...
Graphics 640, 480

EndGraphics
ExecFile "calc.exe"
End
This will also fix the common 'music playing whilst visiting the website' problem ;o)


Nexic(Posted 2004) [#4]
When I wrote the above I had forgotten the exact syntax but that is what I meant. I should have mentioned that sorry.

The actual code I have at the moment:

ExecFile("Registrator.exe 1 0")
End


When you use that code does the program end immediately or do you have to reopen the game window before it closes?

EDIT: I just tried Yan's suggestion and it sorted everything, thanks :)


Damien Sturdy(Posted 2004) [#5]
Fullscreen programs are frozen when not maximized.... The endGraphics command i think brings up the blitz standard window which will then continue to run when execfile is run, alowing you to exit the program.