* 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 Suspend : Integer; virtual;
Function Terminate (AExitCode : Integer): Boolean; virtual;
Function WaitOnExit : DWord;
Function WaitOnExit : Boolean;
Property WindowRect : Trect Read GetWindowRect Write SetWindowRect;
Property Handle : THandle Read FProcessHandle;
Property ProcessHandle : THandle Read FProcessHandle;

View File

@ -101,9 +101,10 @@ Function Terminate (AExitCode : Integer): Boolean; virtual;
exitcode 'AExitCode'
It returns True on succes, False on failure.
Function WaitOnExit : Integer;
This function returns immediatly if the application is not running,
and waits for the application to finish if it was still running.
Function WaitOnExit : Boolean;
This function returns true if the wait for the process exit was succesful,
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;
Sets the name of the application.

View File

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

View File

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