14
votes

I have the application on Delphi with the following main form initialization:

Application.CreateForm(<class>, <variable>);

It shows the main form when the application starts.

How can I start Delphi application with the hidden main form (or on non-visual mode at all)?

1

1 Answers

21
votes

In project source file set:

Application.ShowMainForm := false;

just before main form creation:

Application.CreateForm(TMainForm, MainForm);

Update from Remy:

You can also set it in the MainForm's OnCreate event. The requirement is to set ShowMainForm before Application.Run() is called.

Update from gabr: Main form must also have Visible property set to False