I would like to terminate a Delphi application without executing any other code line and I\'m wondering about which is the proper way to do this. Furthermore, I would like to kn
Application.Terminate() breaks the message loops in TApplication.Run() and TForm.ShowModal(), allowing the main thread to exit normally, perform necessary cleanups, etc.
Vcl.Forms.TApplication.Terminate
Ends application execution.
Call
Terminateto end the application programmatically. By callingTerminaterather than freeing the application object, you allow the application to shut down in an orderly fashion.
Terminatecalls the Windows APIPostQuitMessagefunction to perform an orderly shutdown of the application.Terminateis not immediate.Terminateis called automatically on a WM_QUIT message and when the main form closes.
Halt(), on the other hand, is an immediate abnormal termination. Basically, ripping the process out of memory. Use it only in extreme situations where no other option is available.
System.Halt
Initiates the abnormal termination of a program.
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
Terminatemethod on the globalApplicationobject. If the application does not use a unit that provides anApplicationobject, call theExitprocedure from the main Program block.