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?

Recommended Answers

All 5 Replies

Go to your dpr file and change the line

Application.CreateForm(TMainForm, MainForm);

with what you need

Application.CreateForm(TYourLoginForm, YourLoginForm);

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:

http://www.delphi-central.com/splash.aspx

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:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.