EXITCODE property (System)
Description
Returns the exit code of the last process that was executed by the RUNWIN method.
Property Value
This property is a numeric value. When a process exits it normally returns a value to indicate the status of the program when it closed. By convention a successful execution returns an exit code of 0, but this is not enforced.
Property Traits
Development | Runtime | Indexed | Scaled | Synthetic |
---|---|---|---|---|
N/A | Get | No | No | No |
Remarks
When executing a process with RUNWIN in an asynchronous fashion this property is only valid when accessed from the specified callback routine.
If several asynchronous tasks are executed in a simultaneous fashion then the valid of the EXITCODE property may not be accurate when accessed in the callback – as it is a global property it may be overwritten by a different, subsequent process exit before the callback can be executed.
Example
// Execute an asynchronous process with a callback stored procedure defined. CmdLine = "c:\devtools\myproc.exe /D=34 /A=Wibble" CmdArgs = "" CmdArgs<1> = 1 ; // Show Normal, Async CmdArgs<2> = "MY_CALLBACK_PROC" ; // Stored Proc to call on exit CndArgs<3> = "myproc" ; // Argument to pass to proc CmdArgs<4> = Drive() ; // Working Directory Call Exec_Method( "SYSTEM", "RUNWIN", CmdLine, CmdArgs ) // ================================================================= // // ================================================================= // // Example stored callback proc Compile Subroutine MY_CALLBACK_PROC( CallBackArg ) If ( CallBackArg == //"myproc" ) Then // We got a callback fom "myproc.exe" - Get it's EXITCODE // and log it ExitCode = Get_Property( "SYSTEM", "EXITCODE" ) Call UpdateLog( "MyProc.exe returned " : ExitCode ) End Return
See Also
RUNWIN method.