Set a Login Password for a Delphi MDI Application

Practice




How do I set a password for logging into a Delphi program with MDI windows?


When the project starts, a login and password entry window is created, then the main window mainform opens, which is an fsmdiform.

In the body of the project itself:
program Mdiapp;

uses
Forms,
.....

begin
PasswordDlg := TPasswordDlg.Create(PasswordDlg);
try PasswordDlg.Show;
if 1=2 then Exit;
finally
PasswordDlg.Free;
end;




Application.Initialize;


Application.CreateForm(TMainForm, MainForm);

Application.CreateForm(TAboutBox, AboutBox);
Application.CreateForm(TClient, Client);
Application.CreateForm(TForm2, Form2);
.....
Please help me figure out how to make the password entry window appear before the program's main window MainForm (MDI) opens?

In other words, you want to know how to make the password get entered first, and only then have the mdi form open?

Here is how you can display a password prompt for logging into the program
program Mdiapp;

uses
............
var
PasswordDlg : TPasswordDlg;

...........

begin

Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.CreateForm(TAboutBox, AboutBox);
................................
Application.CreateForm(TForm30, Form30);
PasswordDlg := TPasswordDlg.Create(PasswordDlg);
PasswordDlg.ShowModal;
PasswordDlg.Free;
Application.Run;

end.

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Software and information systems development"

Terms: Software and information systems development