Sets the return code when an application terminates System unit
  var ExitCode : Integer;
The ExitCode variable is the code returned by a terminating application to the invoker.
The ExitCode value will be displayed in a dialog box if the ErrorAddr variable is non 0 when the program terminates.
Related commands
Addr Gives the address of a variable, function or procedure
ErrorAddr Sets the error address when an application terminates
 Author links

 Download this web site as a Windows program.

Example code : Display the exit code in a termination error dialog
  i : Integer;
  // Set up an error address so that halt shows a termination dialog
  ErrorAddr := Addr(i);

  // Set the program exit code
  ExitCode := 8;
Show full unit code
   When the program terminates, an error dialog is displayed:
   Runtime error    8 at 0069FC94
Delphi Programming Neil Moffatt 2002 - 2020. All rights reserved.  |  Home Page