exemple:
(peut etre plus complexe, mais pioché dans mes sources)
BOOL RunNewProcess(LPCTSTR lpszCmdLine, LPCTSTR lpszRunningDir, DWORD dwTimeout, int* pnRetValue)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL bResult;
int nError;
int nRetWait;
ZeroMemory(&si, sizeof(si));
si.cb=sizeof(si);
si.dwFlags=STARTF_USESHOWWINDOW;
si.wShowWindow=
SW_SHOWMAXIMIZED;
bResult=CreateProcess( NULL, (LPSTR)lpszCmdLine,
NULL, NULL, TRUE, CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS, NULL,
(LPCSTR)lpszRunningDir, &si, &pi);
nError=GetLastError();
if(!bResult)
return FALSE;
if(dwTimeout)
{
nRetWait=WaitForSingleObject(pi.hProcess, dwTimeout);
if(dwTimeout != INFINITE)
if(nRetWait == WAIT_TIMEOUT)
return FALSE;
}
DWORD dwExitCode=0;
GetExitCodeProcess(pi.hProcess, &dwExitCode);
*pnRetValue=(int)dwExitCode;
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return bResult;
}
___________________________________________________________
MagicalementNono 