in Advanced Delphi :: 
If you need to implement some kind of authorization for your Delphi application you might want to display a login / password dialog *before* the main form is created and displayed to the user. In short, the idea would be to create, display, and destroy the "login" dialog before creating the main form.
Read the full article to learn how to Display a LogIn Dialog Before the Main Form of a Delphi Application is Created
Related:

Hi,
I had been trying to solve this problem for a long time until giving up. I couldn’t deal with the fact that first created form become the main form of the application. Creating the password dialog without an owner is a great solution.
But I have a question. Can I create other modal forms in password dialog? Which owner(application or login dialog) should I use?
Anyway, thanks Zarko! Keep it coming.
Durmus
DC005001
I forgot to ask:
Is there a way to hide application button from the taskbar until the main form is created without setting WS_EX_TOOLWINDOW for hidden application window?
Durmus, yes you can create other form. Owner should be NIL, as in:
http://delphi.about.com/od/adptips2005/qt/nilselfapp.htm
As an alternative I would suggest to use a tPageControl (align with client) with the pagetabs hidden. In your code just set the tabSheet with the log-in as active page. Now you can validate the user and switch to the other page(s) progammaticly or quit the application.
Very simple, as far as I know idiot proof and now you got the possibility to show a logo. And your application gets a ‘standard look and feel’ in stead of form of different sizes.
HI,
I am getting 2 errors when i try to compile.
1. unit Graphics is not being found. I verified that this unit is available in $BDS\lib.
2. Error ‘ Unsatisfied forward or external declaration: TLoginForm.FormCreate”
how can i fix these?
i am using turboexplorer delphi, WIN2k
thanks
Have tried this in an existing application. I never get as far as seeing the Passoword form. It falls over on “if TLogInForm.Execute Then …” with the message “Exception EAccess Violation…”
@sriram: I’ve fixed the code example. Form OnCreate is not used.
@Dave: I would need more info: on what line does this AV happen?
hi zarko,,
can i change the main Form at runtime? for example,,i have two forms,,MainForm(is mainform at design),and at runtime i want to change the main form to form2….
i try with method application.mainForm:=Form2; but an error ocured,,thnaks be4
Hmm.. i have another method to show login dialog before main form, and i use it up until now, if you find a flaws with this method, please let me know.
So to show a login dialog before the main form showing, i use Application.ShowMainForm := False. So in the program unit, should look like this:
Application.ShowMainForm := False;
Application.CreateForm(TMainForm,TForm);
Application.CreateForm(TLoginForm,TForm);
Application.Run;
And on the login form, we will show the main form with MainForm.Show after a successful login.
Iwan CS
Hi,
I have one question… How to do a loop with login dialog after wrong login?
Thank you.