(Solved)Problems launching .exe with QProcess
Posted: Thu Feb 17, 2011 2:53 am
Hey guys as some of you may know I’m writing a toolkit for a game engine i’m writing and I need to be able to launch the game itself from within the toolkit. I actually had this working before but i've rewritten the part of the editor which had this code and now the damn thing won't work. I can launch any other program except the game. This is the code i’m using:
The error checking section actually prints running, although i cannot see the process in the task manager and nothing appears on the screen. The engine is written with SDL and OpenGL. I can launch it from the command line with no issues and I can launch any other program using QProcess so I can’t see any reason this wouldn’t work. If anyone could shed some light on the issue that would be great.
Also when i launch the .exe normally (by double clicking) it produces a command prompt which then opens the game window, I don’t know if this is relevant but I was thinking that the second window may not be considered the same process and is being killed.
EDIT: I was thinking of trying startDetached() since you can set the working dir in that aswell to see if that would make a difference, any thoughts?
Code: Select all
QProcess *engine = new QProcess(this);
QString path("C:\\sandbox\\Engine_win\\dist\\Release\\MinGW-Windows");
engine->setWorkingDirectory(path);
QString program = "\"" + path + "\\engine_win.exe\"";
engine->start(program);
//Error checking
if(engine->waitForStarted(2000) == true)
{
qDebug() << "running";
}
Also when i launch the .exe normally (by double clicking) it produces a command prompt which then opens the game window, I don’t know if this is relevant but I was thinking that the second window may not be considered the same process and is being killed.
EDIT: I was thinking of trying startDetached() since you can set the working dir in that aswell to see if that would make a difference, any thoughts?