How to make a login form in Delphi simply

1. Do not create loginFORM in the project file

  Application.Initialize;
  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TMainForm, MainForm);
  Application.Run;

 

2 In the FormCreate of the main form

procedure TMainForm.FormCreate(Sender: TObject);
begin
  with TLoginForm.Create(self) do
  try
    ShowModal();
  finally
    Free()
  end;
end;

 

3. Reload the login form

  protected
    procedure CreateParams(var Params: TCreateParams); override;

procedure TLoginForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
end;

 

Guess you like

Origin blog.csdn.net/warrially/article/details/91960762