moi j'ai un ex avec un process ..
void CShutDownDlg::Launch()
{
int iValue = IDYES;
CString str;
str.LoadString(IDS_AVERTISSEMENT);
if(m_End)
iValue = AfxMessageBox(str, MB_YESNO, 0 );
if (iValue == IDYES )
{
STARTUPINFO sui ;
PROCESS_INFORMATION pi ;
sui.cb = sizeof (STARTUPINFO);
GetStartupInfo (&sui);
sui.dwFlags = STARTF_USESHOWWINDOW ;
if(m_Type)
sui.wShowWindow = SW_MINIMIZE ;
else
sui.wShowWindow = SW_NORMAL ;
DWORD dwCreationFlags = CREATE_NEW_CONSOLE;
switch(m_Priority.GetCurSel())
{
case 0 : dwCreationFlags = dwCreationFlags | IDLE_PRIORITY_CLASS;break;
case 1 : dwCreationFlags = dwCreationFlags | NORMAL_PRIORITY_CLASS;break;
case 2 : dwCreationFlags = dwCreationFlags | HIGH_PRIORITY_CLASS;break;
case 3 : dwCreationFlags = dwCreationFlags | REALTIME_PRIORITY_CLASS;break;
default : dwCreationFlags = dwCreationFlags | NORMAL_PRIORITY_CLASS;break;
}
// Creation du process
if(CreateProcess (GetPath(),
GetParameter(),
NULL,
NULL,
FALSE,
dwCreationFlags,
NULL,
NULL,&sui,&pi) == 0)
AfxMessageBox(IDS_ERRORPROCESS, MB_OK | MB_ICONSTOP);
else
{
PID = pi.dwProcessId;
UpdateData(FALSE);
ShowWindow(SW_HIDE);
// Attente de la fin du process fils
WaitForSingleObject(pi.hProcess, INFINITE);
if(m_End) Exit();
else OnQuit();
}
}
}