Hi Alain,
Here's one way to do it:
STARTUPINFO Startup;
PROCESS_INFORMATION Process;
DWORD ExitCode;
ZeroMemory(&Startup, sizeof(Startup));
Startup.cb = sizeof(Startup);
if (CreateProcess("calc.exe", NULL, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &Startup, &Process))
{
CloseHandle(Process.hThread);
do
{
// << You can do some background processing here if you want. >>
Application->ProcessMessages();
if (!GetExitCodeProcess(Process.hProcess, &ExitCode))
break;
} while (ExitCode == STILL_ACTIVE);
CloseHandle(Process.hProcess);
}
else
Application->MessageBox("Unable to launch Calculator.", "Error", MB_OK);
Hope this helps,
Martin