There are two ways of getting the exit code from your PowerBuilder application. The first is declaring an external function, as the source below:
SUBROUTINE ExitProcess(ulong uExitCode) LIBRARY "kernel32.dll"
Now, just call the function, passing the desired exit code:
ExitProcess(42)
The second is to use the LongParm attribute of Message object in the Close event of the application:
//Application's Close event Message.LongParm = 42
The exit code will be stored in the %ERRORLEVEL% variable.
To test it out:
$ start /w rn_demos.exe $ echo %ERRORLEVEL% 42
The following two tabs change content below.
Software Architect and Backend Developer (almost Fullstack), I usually work with C#, PowerShell, Python, Golang, bash and Unity (this one is more for a hobby). I'm always looking for something new to learn, adding new tools to my utility belt.
Latest posts by Breno RdV (see all)
- What is a metaclass and how it works. (#python #dev #metaclass) - January 11, 2023
- Understanding the magic of Generators. (#python, #dev, #generator, #iterator) - December 28, 2022
- Facebook comments on posts. (info) - June 23, 2020