Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter FourFlow Control (continued)

GetProcessExitCode Function

Overview

The GetProcessExitCode function will retrieve a process’ termination status.

Syntax/Parameters

Syntax

dword = GetProcessExitCode ( handle hObject );

Parameters

hObject

A handle to a compatible object.

Return Value

Returns a dword as a code or a formatted error code on failure. Use the GetLastError function to retrieve error information.

Remarks

This function will return immediately and not wait for the process to complete. Checking a process that is still running will result in a code of STILL_ACTIVE (259) with a companion formatted error code in the last error buffer. A script cannot check the process status of a process for which it does not have access rights.

The GetProcessExitCode function returns the process’ exit code as defined by the process itself only after the process terminates. A foreign application should not use STILL_ACTIVE (259) as an exit code, but this may be beyond the control of the programmer. Using this function to test for the completion of a process within a loop may result in an infinite loop if the process returns STILL_ACTIVE (259); therefore, the WaitForObject function is preferable to testing whether a process is still running.

The GetLastError function must be used to differentiate between a formatted error code caused by the GetProcessExitCode function failing or a process return value that appears as a formatted error code.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic