Run EXE from Blitzmax program
BlitzMax Forums/BlitzMax Programming/Run EXE from Blitzmax program
| ||
| How do you run an exe file from a BlitzMax program, I can't seem to find any command to do it :( Thanks, |
| ||
| Heh nevermind, I remembered what I used from C++ and tried it out- lo and behold it works! |
| ||
| You can use CreateProcess and/or _System (if memory serves). |
| ||
| 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
|
| ||
| 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 ? |
| ||
| 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. |
| ||
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 |
| ||
| ShellExecute |