Name
Halt Procedure
Syntax
procedure Halt(ExitCode: Integer);
Description
Halt terminates an application immediately,
without giving it time to clean up after itself. Windows NT
automatically releases any resources that the application was using,
but Windows 95 and Windows 98 are less forgiving. Do not use
Halt except in unusual circumstances, such as part
of a last-ditch, catch-all exception
handler.
Halt is not a real procedure.
Tips and Tricks
Haltsaves its argument in the globalExitCodevariable.If the
ErrorAddrvariable is notnil,Haltprints an error message before it terminates the program.The
ExitProcprocedure and units’ finalization sections get to run before the program terminates.Haltshuts down the program without freeing all objects and forms. A GUI application should close the main form to terminate the application instead of callingHalt.
Example
// Report a run-time error at a specific address.
procedure ReportError(ErrorCode: Integer; Addr: Pointer);
begin
ErrorAddr := Addr;
if ErrorProc <> nil then
ErrorProc(ErrorCode, Addr);
Halt(ErrorCode);
end;See Also
| ErrorProc Variable, ExceptProc Variable, ExitCode Variable, ExitProc Variable, Finalization Keyword, NoErrMsg Variable, RunError Procedure |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access