Salut!
On peut se le faire comme ça aussi:
// Prepare the external script execution via a process
CString _CommandLine = CString("C:\\truc.bat arg1 arg2");
STARTUPINFO _SI;
PROCESS_INFORMATION _PI;
// Connect standard handles
ZeroMemory(&_SI,sizeof(STARTUPINFO));
_SI.cb=sizeof(STARTUPINFO);
_SI.dwFlags=STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES;
_SI.wShowWindow=SW_HIDE;
_SI.dwFlags=STARTF_USESTDHANDLES;
_SI.hStdInput=NULL;
_SI.hStdOutput=NULL;
_SI.hStdError=NULL;
// Create process and wait for achievement
CreateProcess(NULL, (LPTSTR)_CommandLine.GetString(), NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &_SI, &_PI);
DWORD _Result = WaitForSingleObject(_PI.hThread, INFINITE);
// ...
L'avantage (contrairement à ShellExecute) c'est qu'une fois sorti de là, on sait que le process est terminé.
Buno
----------------------------------------
L'urgent est fait, l'impossible reste à faire. Pour les miracles, prévoir un délai...