No Main Form Delphi Application
Monday April 7, 2008
in Delphi TIPS ::
Every Delphi application must have a main form. The main form is the first form created in the body of the application. When the main form closes, the application terminates.
Every Delphi application must have a main form. The main form is the first form created in the body of the application. When the main form closes, the application terminates.
What if you need to create an application where every form is equally important (for example like IE) - where closing the main form will *not* close the application?
Read the full article to learn How to Avoid Having a Main Form in a Delphi Application
Related:


If you want to automatically close your hidden main form, do not forget the form destruction in TAppForm.FormClose. Without the caFree, FormCount do not decrement and your application never terminate.
Fix it like that :
procedure TAppForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
//TRUE MAIN and this fake instance
Action := caFree; //