Comment exécuter une commande et ensuite attendre qu'elle se termine.
procédure ExecAndWait(ligne de commande: string CommandShow: Longint)
var
& nbsp & nbsp pi: TProcessInformation
& nbsp & nbsp si: TStartupInfo
begin
& nbsp & nbsp FillChar(si, sizeof(si), #0)
& nbsp & nbsp es.cb := sizeof(si)
& nbsp & nbsp es.dwFlags := STARTF_USESHOWWINDOW
& nbsp & nbsp es.wShowWindow := CommandShow
& nbsp & nbsp CreateProcess(nil, PChar(ligne de commande), de néant, de néant, de Faux, NORMAL_PRIORITY_CLASS, de néant, de néant, si, pi)
& nbsp & nbsp WaitForSingleObject(pi.hProcess, INFINI)
& nbsp & nbsp CloseHandle(pi.hProcess)
& nbsp & nbsp CloseHandle(pi.hThread)
fin
Execandwait
Execandwait : Plusieurs milliers de conseils pour vous faciliter la vie.
Comment executer une commande et ensuite attendre qu'elle se termine.
procedure ExecAndWait(ligne de commande: string CommandShow: Longint)
var
& nbsp & nbsp pi: TProcessInformation
& nbsp & nbsp si: TStartupInfo
begin
& nbsp & nbsp FillChar(si, sizeof(si), #0)
& nbsp & nbsp es.cb := sizeof(si)
& nbsp & nbsp es.dwFlags := STARTF_USESHOWWINDOW
& nbsp & nbsp es.wShowWindow := CommandShow
& nbsp & nbsp CreateProcess(nil, PChar(ligne de commande), de neant, de neant, de Faux, NORMAL_PRIORITY_CLASS, de neant, de neant, si, pi)
& nbsp & nbsp WaitForSingleObject(pi.hProcess, INFINI)
& nbsp & nbsp CloseHandle(pi.hProcess)
& nbsp & nbsp CloseHandle(pi.hThread)
fin