0

I already know how to call a program an make it run inside of my program (with no communication between the two). But I need a way too call a separate program from mine and have it run separately. I looked into the CreateProsses thing but it seems to be a WIN32 thing and I get lost in those easier than I get lost in system32. Can anyone help? Is there a system command for this, o really hat taking the lazy way but right now I wouldn't mind letting Windows do this for me.

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Ancient Dragon
0

Any reason you couldnt use system to do this?
It is a blocking call so you'd have to wait until the other process returned or you could look into something like _spawnlp with _P_NOWAIT .

0

CreateProcess() isn't really all that difficult once you realize most parameters are 0. That function does not wait for the newly created process to finish. If you want that behavior then you have to call WaitForSingleObject() after calling CreateProcess().

STARTUPINFO sinfo;
PROCESS_INFORMATION pInfo;
memset(&sinfo,0,sizeof(STARTUPINFO));
sinfo.cb = sizeof(STARTUPINFO);
BOOL b = CreateProcess("notepad.exe",NULL,0,0,0,0,0,0,&sinfo,&pinfo);
if( b == 0)
{
   // an error occurred
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.