Mirror

Application.Terminate or Halt() ? (Views: 101)


Problem/Question/Abstract:

Should I use Application.Terminate or Halt() ? And what are the differences?

Answer:

Application.Terminate closes the main window and that way the application in a clean fashion. Halt() shuts down right away, e.g. memory may not be freed, tables are not closed and so on.

For D4: Halt can cause AV's on an NT system, usually with Runtime error 216, if DLL's are involved also 217 - Application.Terminate on the other hand cleans without AV.

But: Halt worked with D2, even the cleaning of the memory did work....

Then again, if you write a console application, you have to use halt(), since there probably is no Application object.

<< Back to main page