RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.Halt Function

Initiates abnormal termination of a program.

Pascal
procedure Halt; overload;
procedure Halt(Exitcode: Integer); overload;
C++
Halt();
Halt(int Exitcode);

System

Halt performs an abnormal termination of a program and returns to the operating system.  

To perform a normal termination of a Delphi application, call the Terminate method on the global Application object. If the application does not use a unit that provides an Application object, call the Exit procedure from the main Program block. 

Exitcode is an optional expression that specifies an exit code for the program.  

Delphi Examples: 

 

{
This example halts before the TextOut and terminates the
application.  Do not expect to one step this procedure.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
   if 1 = 1 then
     begin
       if 2 = 2 then
         begin
           if 3 = 3 then
             begin
               Halt(1); { Halt right here! }
             end;
         end;
     end;
   Canvas.TextOut(10, 10, 'This will not be executed');
 end;

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!