..run exe from within another one..

BlitzMax Forums/BlitzMax Programming/..run exe from within another one..

Naughty Alien(Posted 2009) [#1]
..well.... how should i run external exe from Bmax application? I want to start Settings.exe, do game settings or what not in there, then when click run button, Settings.exe should be terminated and Game.exe started...how?


plash(Posted 2009) [#2]
Function system_(command:String)
Which can be found in pub.stdc.


_Skully(Posted 2009) [#3]
Won't that wait for execution to complete before continuing? or can it fire and forget?


Naughty Alien(Posted 2009) [#4]
..i dont know..thats why im asking..what I need is just setup.exe running main game after basic settings is done, so setup.exe should 'die and never come back' :) and game.exe should run...


plash(Posted 2009) [#5]
You could probably use TProcess in that case.. or maybe OpenUrl. Though I'm not sure what the blocking rules are for OpenUrl, it should just work.


Tommo(Posted 2009) [#6]
Import pub.freeprocess

local cmd$="xxxxx.exe"
local p:TProcess = createProcess(cmd)
TProcess.ProcessList.Remove(p)


This should work. But I'm not sure if it's safe.


Naughty Alien(Posted 2009) [#7]
..hmm..this doesnt work..Game.exe im calling, appear in Task Manager, but i cant see program running on screen...hmm...anyone has some working example?? Ill appreciate that a lot..


Zeke(Posted 2009) [#8]
Extern "Win32"
	Function WinExec (lpCmdLine:Byte Ptr, nCmdShow:Int)
End Extern


and then WinExec("game.exe",10)


Naughty Alien(Posted 2009) [#9]
..thank you very much Zeke..it works like a charm..


Nate the Great(Posted 2009) [#10]
if you want cross platform capability why not use openurl("game.exe") then and end command right after that...