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 32 33 34 35 36 37 38 39 40 41 42 43 44
|
void __fastcall TForm1::wtClick(TObject *Sender)
{
AnsiString exeName, options ;
exeName ="C:\\Process\\wt.exe" ;
PROCESS_INFORMATION ProcessInformation;
STARTUPINFO StUpInfo;
StUpInfo.cb = sizeof(StUpInfo);
StUpInfo.lpReserved = NULL;
StUpInfo.lpDesktop = NULL;
StUpInfo.lpTitle = NULL;
StUpInfo.dwFlags = 0;
StUpInfo.cbReserved2 = 0;
StUpInfo.lpReserved2 = NULL;
//on execute le process et on attend la fin d'execution
if (CreateProcess( exeName.c_str(),
NULL, NULL,NULL,false,
DETACHED_PROCESS,
NULL,NULL,
&StUpInfo,&ProcessInformation) )
{
//Attente de la fin de l'execution du Processus
ProgressBar1->Min = 0;
ProgressBar1->Max=50000;
int i= ProgressBar1->Min;
while(i<ProgressBar1->Max)
{ProgressBar1->Position = i;
i++; }
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
}
//Fermeture des ressources
CloseHandle( ProcessInformation.hProcess );
CloseHandle( ProcessInformation.hThread );
Image2->Picture->Bitmap->LoadFromFile("C:\\Process\\B.bmp");
} |
Partager