Run EXE from Blitzmax program

BlitzMax Forums/BlitzMax Programming/Run EXE from Blitzmax program

Leiden(Posted 2005) [#1]
How do you run an exe file from a BlitzMax program, I can't seem to find any command to do it :(

Thanks,


Leiden(Posted 2005) [#2]
Heh nevermind, I remembered what I used from C++ and tried it out- lo and behold it works!


FlameDuck(Posted 2005) [#3]
You can use CreateProcess and/or _System (if memory serves).


EOF(Posted 2005) [#4]
This should work on all three systems. Not certain though.
It uses Skids excellent FreeProcess library.

I have pulled various bits out of my FrameWork Assistant to show you how I implemented the feature:

First, import skidracers module:
Import PUB.FreeProcess

Now create a global TProcess variable:
Global proc:TProcess

When you are ready to launch an external program:
Function RunApp(myapp$)
    ' check if application is still running
    If proc<>Null
        If proc.Status()
            Notify "program still running!"
            Return
        EndIf
    EndIf
    ' run program
    proc=TProcess.Create(myapp$,0)
    If Not Proc
        Notify "Failed to launch "+myapp$
    EndIf
End Function



Progi1984(Posted 2006) [#5]
The problem is if i stop the main program, the other program (that i launch in code) stops too. How can i do for continuying the execution of the other program after the stop of main program ?


FlameDuck(Posted 2006) [#6]
How can i do for continuying the execution of the other program after the stop of main program ?
Probably not the answer you're looking for, but: Use Linux.


Eikon(Posted 2006) [#7]
Try this. It allows the launched program to continue after the parent program has closed.

Extern "win32"
	Function WinExec(lpCmdLine$z, nCmdShow)
End Extern

WinExec Chr$(34) + "notepad" + Chr$(34), 1
End



Kanati(Posted 2006) [#8]
ShellExecute