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.

Recommended Answers

All 2 Replies

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 .

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
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.