Bonjour à tous,

j'ai ici du code trouvé sur ce même forum qui exécute une commande dos, j'aimerais simplement y inclure l'état d'avancement avec une barre de progression. Pouvez-vous m'aider SVP ? Je vois pas trop sur quoi je peux me baser pour faire avancer ma gauge !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
45
46
47
function TfrmMain.ExecuteCommande(Commande: String;Attente : Boolean = True): Boolean;
Var
  lpsaProcess,
  lpsaThread    : PSecurityAttributes;
  StartupInfo   : TStartupInfo;
  ProcessInfo   : TProcessInformation;
  AddrCmd       : Array [0..255] Of Char;
  ExitCode      : DWord;
begin
  FillChar(StartupInfo, SizeOf(TStartupInfo), 0);
  with StartupInfo do
  begin
    cb          := SizeOf(TStartupInfo);
    dwFlags     := STARTF_USESHOWWINDOW or STARTF_FORCEONFEEDBACK;
    wShowWindow := SW_HIDE;
  end;
 
  New(lpsaProcess);
  New(lpsaThread);
 
  lpsaProcess^.nLength              := SizeOf(lpsaProcess^);
  lpsaProcess^.lpSecurityDescriptor := Nil;
  lpsaProcess^.bInheritHandle       := True;
 
  lpsaThread^.nLength              := SizeOf(lpsaThread^);
  lpsaThread^.lpSecurityDescriptor := Nil;
  lpsaThread^.bInheritHandle       := True;
 
  StrPCopy(AddrCmd, Commande);
  Result := CreateProcess(nil, AddrCmd, lpsaProcess, lpsaThread, False,
                          STARTF_FORCEONFEEDBACK, nil, nil, StartupInfo, ProcessInfo);
  if not Result then Result:=(GetLastError>10000);
  Dispose(lpsaProcess);
  Dispose(lpsaThread);
  if Result then
  begin
    while Attente do
    begin
      // Solution d'attente 1
      Sleep(500);
      GetExitCodeProcess(ProcessInfo.hProcess, ExitCode);
      if ExitCode<>STILL_ACTIVE then break;
    end;
    CloseHandle(ProcessInfo.hThread);
    CloseHandle(ProcessInfo.hProcess);
  end;
end;
Merci à tous !