DelphiBasics
RunError
Procedure
Terminates the program with an error dialog System unit
 procedure RunError({ ExitValue Integer });
Description
The RunError procedure forces an abrupt termination of the current application.
 
Warning : resources cannot be guaranteed to be freed when calling RunError.
 
Optionally, the ExitCode variable may be set by passing an ExitValue. This code is returned to the application invoker as the return code from the application.
 
A dialog is displayed showing the ErrorAddr (where the RunError was executed) and ExitCode values.
 
After RunError executes, the finalization section of the unit is executed before the program actually terminates.
Notes
Warning : use only in exceptional circumstances.
Related commands
BreakForces a jump out of a single loop
ExitExit abruptly from a function or procedure
ExitCodeSets the return code when an application terminates
GotoForces a jump to a label, regardless of nesting
HaltTerminates the program with an optional dialog
AbortAborts the current processing with a silent exception
 Download this web site as a Windows program.




 
Example code : Terminate a program with an error dialog
begin
  // Stop the program with exit code 0
  RunError;

  // The following will not be executed
  ShowMessage('We do not get this far');
end;
Show full unit code
  The program terminates without running the ShowMessage statement. An error dialog is displayed:
  
  Runtime error 0 at 00452105
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page