1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| for(indice=0;indice<ind;indice++)
{
// LANCE LE PROCESSUS
char* buffer=(char*)LPCTSTR(tab[indice]);
CPythagoreApp * theApp = static_cast<CPythagoreApp *>(AfxGetApp());
CDocTemplate* curTemplate = theApp->GetDocTemplate("Sortie");
curTemplate->OpenDocumentFile(buffer);
// RECUPERE LE POINTEUR DU PROCESSUS
FILE* ProcessID;
DWORD aProcesses[1024], cbNeeded, cProcesses,Code,return_id=0;
unsigned int indice2;
if(!EnumProcesses( aProcesses, sizeof(aProcesses), &cbNeeded)) return;
cProcesses = cbNeeded / sizeof(DWORD);
for ( indice2 = 0; indice2 < cProcesses; indice2++ )
{
return_id=PrintProcessNameAndID( aProcesses[indice2],ProcessID ,tab[indice]);
}
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, return_id);
// VERIFIE SI LE PROCESSUS EST EN COURS D'EXECUTION OU PAS
//DWORD seconde = 1000;
GetExitCodeProcess(hProc, &dwExitCode);
while(dwExitCode == STILL_ACTIVE)
{
Sleep(1000);
}
} |
Partager