Delphi How to use the DelphiVCL.Application.Destroy Property

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
How to use the DelphiVCL.Application.Destroy Property
By Muhammad Azizul Hakim June 13, 2021

We use DelphiVCL.Application.Destroy to destroy the application instance and all of its associated memory.

Never call DelphiVCL.Application.Destroy or DelphiVCL.Application.Free. Instead, use the application’s Terminate method to end the application.

Destroy signals that the application has been deactivated before calling the inherited destructor. It then frees memory for hooked windows, the application instance, other object instances and lists that were created at application startup or that accumulated during execution

Since the Application owns all forms (usually), it destroys these forms in its destructor.

Let’s browse all the properties, methods, and built-in properties of the DelphiVCL.Application.Destroy using dir() command:
Python:
import DelphiVCL
 
dir(DelphiVCL.Application.Destroy)
See the responses in our Windows command prompt:
1623589354898.png
Here is the working example of the implementation of DelphiVCL.Application.Destroy:
Python:
def main():
    Application.Initialize()
    Application.Title = "MyDelphiApp"
    f = MainForm(Application)
    f.Show()
    FreeConsole()
    Application.Run()
    Application.Destroy()
 
main()
See the complete code Для просмотра ссылки Войди или Зарегистрируйся and Для просмотра ссылки Войди или Зарегистрируйся.