Okay so I am working on small program, and halfway through I decided to make a login screen at the start. How do I make it that the login screen shows up before the main form?

6 Years
Discussion Span
Last Post by anijacity

Go to your dpr file and change the line

Application.CreateForm(TMainForm, MainForm);

with what you need

Application.CreateForm(TYourLoginForm, YourLoginForm);

Edited by Ionelul: n/a


Okay so I did this, but now it says Fatal Error : could not create output file when I try to run the program. This is really bad I'm not redoing all that work.


That's because the answer given you is not correct -- the very first form auto-created in your DPR is the application's main form -- which is not what you want.

You still need to edit the DPR, but in a different way. If you google around "delphi spash screen" you'll get some good hits, like this one:


Good luck!


The main form isn't something you're allowed to change in Delphi. You managed to find a way that appears to work half-way, but it's a hack. Stop doing that.

An application has only one main form, and it's the first form that finishes being created via CreateForm. If you need two radically different behaviors for the main form, then you can try a couple of techniques:

Edited by Narue: Removed fake signature

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.