你如何干净地中止Delphi程序?

Mas*_*ler 19 delphi shutdown abort

我有一个程序在关机期间遇到了一些麻烦,引发了我无法追溯到其来源的异常.它似乎与时间相关且不确定.这是在所有共享资源被释放后发生的,并且由于它已经关闭,因此内存泄漏不是问题,所以这让我想知道是否有任何方法只是告诉程序在释放共享资源后立即和静默终止,而不是继续关闭序列并给出一个异常消息框.

有谁知道这是怎么做到的吗?

PA.*_*PA. 19

查看Delphi Run Time Library源代码后,以及Microsoft文档; 我可以证实Mason和Paul-Jan的评论.

关闭的层次结构如下

  Application.Terminate()
    performs some unidentified housekeeping of application
    calls Halt()

  Halt()
    calls ExitProc if set
    alerts the user in case of runtime error
    get rid of PackageLoad call contexts that might be pending
    finalize all units
    clear all exception handlers
    call ExitprocessProc if set
    and finally, call ExitProcess() from 'kernel32.dll'

  ExitProcess() 
    unloads all DLLs
    uses TerminateProcess() to kill the process
Run Code Online (Sandbox Code Playgroud)


Hea*_*are 6

ExitProcess(0)?