Description |
The ErrorAddr variable is set to the address of an error when an application termination condition is reached. The value is displayed in an error dialog.
Delphi itself also stores the address of a code error when a run time error is encountered.
|
|
Related commands |
Addr |
|
Gives the address of a variable, function or procedure |
ErrorAddr |
|
Sets the error address when an application terminates |
Exit |
|
Exit abruptly from a function or procedure |
|
|
|
|
Example code : Display an error address in a termination error dialog |
// Full Unit code. // ----------------------------------------------------------- // You must store this code in a unit called Unit1 with a form // called Form1 that has an OnCreate event called FormCreate. unit Unit1; interface uses // The System unit does not need to be defined Forms, Dialogs; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} // Include form definitions procedure TForm1.FormCreate(Sender: TObject); var
i : Integer;
begin // Set up an error address so that halt shows a termination dialog
ErrorAddr := Addr(i);
// Set the program exit code
ExitCode := 8;
end; end.
|
Hide full unit code |
When the program terminates, an error dialog is displayed:
Runtime error 8 at 0069FC94
|
|