1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| function LanceAppliAttenteFin(NomFichier:string):boolean;
var
StartInfo : TStartupInfo;
ProcessInformation : TProcessInformation;
exCode : LongWord;
begin
result:=true;
ZeroMemory(@StartInfo, sizeof(StartInfo));
StartInfo.cb:=sizeof(StartInfo);
StartInfo.dwFlags := STARTF_USESHOWWINDOW;
StartInfo.wShowWindow := SW_HIDE;
if CreateProcess(nil,PChar(NomFichier),nil,nil,true,0,nil,nil,StartInfo,ProcessInformation) then
begin
WaitForSingleObject(ProcessInformation.hProcess, INFINITE);
GetExitCodeProcess(ProcessInformation.hProcess, exCode);
showmessage ('exit code = ' + IntToStr(exCode));
end
else result:=false;
end; |
Partager