
Using ShellExecute() go online
You could use something like this which will wait for the process to end.
Remove the part after ExitCode if you don't want to wait for the process to
end. You will also want to change the StartupInfo.wShowWindow value to a
value which doesn't hide the window.
Good Luck
Chris
STARTUPINFO StartupInfo;
GetStartupInfo(&StartupInfo);
PROCESS_INFORMATION ProcessInformation;
CString CommandLine;
BOOL retval;
DWORD ExitCode;
StartupInfo.dwFlags = 1;
StartupInfo.wShowWindow = 0;
BeginWaitCursor();
CommandLine = "Your.exe";
retval=CreateProcess(NULL, CommandLine.GetBuffer(CommandLine.GetLength()),
NULL, NULL, 0, 0, NULL, NULL, &StartupInfo, &ProcessInformation);
if (retval==FALSE)
{
AfxMessageBox("Error running "+ CString(CommandLine));
return;
}
ExitCode;
// wait until Your.exe is complete
do
{
retval = GetExitCodeProcess(ProcessInformation.hProcess, &ExitCode);
if (retval==FALSE)
{
CString errmsg="Error waiting for "+ CString(CommandLine) +" to end";
AfxMessageBox(errmsg);
return;
}
} while (ExitCode==STILL_ACTIVE);
EndWaitCursor();