Click or drag to resize

ErrorLevel Function (DWord)

X#
Retrieve and optionally set the X# return code.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax
 FUNCTION ErrorLevel(
	dwNewSetting AS DWORD
) AS DWORD
Request Example View Source

Parameters

dwNewSetting
Type: DWord
The new return code setting.
This can be a value between 0 and 255.
The default initial value is 0.
When a X# program terminates, the return code is set to 1 if the process ends with a fatal error.
If the process ends normally, the return code is set to 0 (unless ErrorLevel() was set to something else in the program).
Typically, you would set a return code with ErrorLevel() to indicate an error state to the program that invoked the current X# program. In most cases, this is the application batch file. Here you would test the return code using the DOS ErrorLevel command. (Refer to your DOS manual for more information.)

Return Value

Type: DWord
If dwNewSetting is not specified, ErrorLevel() returns the current setting.
If dwNewSetting is specified, the previous setting is returned.
Remarks
Tip Tip
After a RUN command, a return value of less than 32 from ErrorLevel(), indicates an error. (Refer to the Windows API WinExec() function for more information.)
Examples