Autor Beitrag
hpburner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: So 30.03.03 01:54 
bis das porgramm beendet ist

Wie kann ich das erreichen ?
meinetwegen kann das programm auch per Dos Commandline angesprochen werden.

das programm soll agieren wie eine BatchDatei
also z.B.
call split.exe adx_10.wav
call split.exe adx_11.wav
...
call split.exe adx_77.wav

Es wir immer gewartet bis das programm beendet wurde bis das neue gestartet wird

ich hätte mir das so gedacht bei delphi :
ausblenden Quelltext
1:
2:
for i := 10 to 77 do
ShellExecute(0, nil, PChar('Split.exe'), PChar('ADX_'+IntToStr(i)+'.wav'), nil, SW_Shownormal);


das funzt so allerdings nicht da ja das porgramm 77mal (fast) auf einmal aufgerufen wird
das darf es allerdings nicht ?!
gibt es da eine möglichkeit das zu machen ?!

Es gibt ja eine funktion ShellExecAndWait aber da kann ich glaube ich keine parameter übergeben was mich nicht weiterbringt =(
hat einer ne lösung für mein problem ?!


danke im vorraus
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 30.03.03 01:59 
Ruf es mit CreateProcess auf. Da bekommst du die ProzessID, welche du an WaitForSingleObject übergeben kannst.
hpburner Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: So 30.03.03 14:18 
Titel: thx
hab es so gelöst wie du meintest
dien procedure sieht dann so aus :

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Procedure ExecAndWait(ExecuteFile, Param :String);
var
Pr_inf: TProcessInformation;
St_inf: TStartupInfo;
begin
FillChar(Pr_inf, sizeof(TProcessInformation), 0);
FillChar(St_inf, sizeof(TStartupInfo), 0);
St_inf.cb := sizeof(TStartupInfo);
if CreateProcess(Pchar(ExecuteFile), PChar(Param),nil ,
nil, false, NORMAL_PRIORITY_CLASS, nil, nil,
St_inf, Pr_inf) <> False then 
begin
WaitForSingleObject(Pr_inf.hProcess, INFINITE);
CloseHandle(Pr_inf.hProcess);
WriteLn(ExecuteFile+' '+Param+' processed');
end 
else WriteLn(ExecuteFile+' couldn't be executed');
end;