Bonjour à toutes et à tous,
Avec cette fonction la première exécution est correcte mais ensuite cela bug comme si la 1ère exécution était toujours en cours.
Exécution :
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 function ExeAndWait(ExeNameAndParams: string; ncmdShow: Integer = SW_SHOWNORMAL): Integer; var StartupInfo: TStartupInfo; ProcessInformation: TProcessInformation; Res: Bool; lpExitCode: DWORD; begin with StartupInfo do //you can play with this structure begin cb := SizeOf(TStartupInfo); lpReserved := nil; lpDesktop := nil; lpTitle := nil; dwFlags := STARTF_USESHOWWINDOW; wShowWindow := ncmdShow; cbReserved2 := 0; lpReserved2 := nil; end; Res := CreateProcess(nil, PChar(ExeNameAndParams), nil, nil, True, CREATE_DEFAULT_ERROR_MODE or NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo, ProcessInformation); while True do begin GetExitCodeProcess(ProcessInformation.hProcess, lpExitCode); if lpExitCode <> STILL_ACTIVE then Break; Application.ProcessMessages; end; Result := Integer(lpExitCode); end;
Si quelqu'un à une idée merci d'avance.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 procedure TForm1.Rbmp3_amrClick(Sender: TObject); begin ExeAndWait('Mp3_Amr.bat', SW_HIDE); end; procedure TForm1.Rbmp3_m4rClick(Sender: TObject); begin ExeAndWait('Mp3_M4r.bat', SW_HIDE); end;
@+,
cincap
Partager