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

1

16

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

Eating answered 26/6, 2014 at 23:25 Comment(0)
N
23

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

Nepali answered 26/6, 2014 at 23:35 Comment(4)
You can also set it in the MainForm's OnCreate event. The requirement is to set ShowMainForm before Application.Run() is called.Regimen
Is it possible to keep the taskbar icon visible? I have a login form which only makes the main form visible once login succeeds, but then there's no taskbar icon (or alt-tab thumbnail). Sorry for wanting my cake and eating it :)Needlepoint
@DaveBoltman Instead of hiding the form just set the forms WindowState to wsMinimized.Rabbitfish
Main form must also have Visible property set to False.Atlantic

© 2022 - 2024 — McMap. All rights reserved.