(Solved)Problems launching .exe with QProcess

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

(Solved)Problems launching .exe with QProcess

Post by MrDeathNote »

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:

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";
}
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?
Last edited by MrDeathNote on Thu Feb 17, 2011 12:59 pm, edited 1 time in total.
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
User avatar
MrDeathNote
ES Beta Backer
ES Beta Backer
Posts: 594
Joined: Sun Oct 11, 2009 9:57 am
Current Project: cocos2d-x project
Favorite Gaming Platforms: SNES, Sega Megadrive, XBox 360
Programming Language of Choice: C/++
Location: Belfast, Ireland
Contact:

Re: Problems launching .exe with QProcess

Post by MrDeathNote »

I've solved this, it's because the subsystem of the engine was set to console.
http://www.youtube.com/user/MrDeathNote1988

Image
Image

"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup
Post Reply