Ok und was kann ich da machen?
Ich habe schon TThreads anstelle der while Schleife benutzt. Also so:
Delphi-Quellcode:
CreateProcess(nil,PChar(cmdline),nil,nil,true,CREATE_DEFAULT_ERROR_MODE or PROFILE_USER or CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS,nil,nil,sui,pi);
if pi.hProcess <> 0 then
begin
Thread := TPipeThread.Create(true);
try
Thread.Pipe := Self;
Thread.ProcessHandle := pi.hProcess;
Thread.Execute;
finally
Thread.Free;
end;
TerminateProcess(pi.hProcess,Cardinal(-1));
end;
procedure TPipeThread.Execute;
begin
while (WaitForSingleObject(ProcessHandle,1) <> WAIT_OBJECT_0) and (not Pipe.FTerminate) do
begin
Synchronize(Pipe.ReadPipeData);
Application.ProcessMessages;
end;
end;
Das Ergebnis war allerdings das Gleiche.. Oder ist daran auch etwas falsch? Muss ich es ganz anders machen?
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."