* WaitOnExit now returns a boolean

git-svn-id: trunk@5576 -
This commit is contained in:
michael 2006-12-11 22:06:04 +00:00
parent 968f44d0b4
commit e4fb3f71d3
4 changed files with 20 additions and 11 deletions

View File

@ -101,7 +101,7 @@ Type
Function Resume : Integer; virtual; Function Resume : Integer; virtual;
Function Suspend : Integer; virtual; Function Suspend : Integer; virtual;
Function Terminate (AExitCode : Integer): Boolean; virtual; Function Terminate (AExitCode : Integer): Boolean; virtual;
Function WaitOnExit : DWord; Function WaitOnExit : Boolean;
Property WindowRect : Trect Read GetWindowRect Write SetWindowRect; Property WindowRect : Trect Read GetWindowRect Write SetWindowRect;
Property Handle : THandle Read FProcessHandle; Property Handle : THandle Read FProcessHandle;
Property ProcessHandle : THandle Read FProcessHandle; Property ProcessHandle : THandle Read FProcessHandle;

View File

@ -101,9 +101,10 @@ Function Terminate (AExitCode : Integer): Boolean; virtual;
exitcode 'AExitCode' exitcode 'AExitCode'
It returns True on succes, False on failure. It returns True on succes, False on failure.
Function WaitOnExit : Integer; Function WaitOnExit : Boolean;
This function returns immediatly if the application is not running, This function returns true if the wait for the process exit was succesful,
and waits for the application to finish if it was still running. false if some error occurded. It returns immediatly if the application is
not running, and waits for the application to finish if it was still running.
Property ApplicationName : String; Property ApplicationName : String;
Sets the name of the application. Sets the name of the application.

View File

@ -340,12 +340,16 @@ begin
WaitOnExit; WaitOnExit;
end; end;
Function TProcess.WaitOnExit : Dword; Function TProcess.WaitOnExit : Boolean;
Var
R : Dword;
begin begin
Result:=fpWaitPid(Handle,pcint(@FExitCode),0); R:=fpWaitPid(Handle,pcint(@FExitCode),0);
If Result=Handle then Result:=(R=Handle);
FExitCode:=WexitStatus(FExitCode); If Result then
FExitCode:=WExitStatus(FExitCode);
FRunning:=False; FRunning:=False;
end; end;

View File

@ -213,11 +213,15 @@ begin
WaitOnExit; WaitOnExit;
end; end;
Function TProcess.WaitOnExit : Dword; Function TProcess.WaitOnExit : Boolean;
Var
R : DWord;
begin begin
Result:=WaitForSingleObject (FProcessHandle,Infinite); R:=WaitForSingleObject (FProcessHandle,Infinite);
If Result<>Wait_Failed then Result:=(R<>Wait_Failed);
If Result then
GetExitStatus; GetExitStatus;
FRunning:=False; FRunning:=False;
end; end;