Dmitry
Dmitry

Reputation: 14622

How can I start Delphi application with the hidden main form?

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)?

Upvotes: 16

Views: 15036

Answers (1)

Antonio Bakula
Antonio Bakula

Reputation: 20693

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

Upvotes: 23

Related Questions