把工程单元的program XXXX;
里边的Application.CreateForm(TMainForm, MainForm);
屏蔽掉。
要想让登录窗口先显示,可以先隐藏主窗口,显示登录窗口的代码卸载主窗口的代码里。
或者,建个不显示的单元,在里边写显示登录窗口的代码,
function UserLogin: boolean;
begin
result:=false;
if not assigned(frmLogin) then
frmLogin := TfrmLogin.Create(nil);
frmLogin.ShowModal;
if (frmLogin.ModalResult=mrOK) then
begin
result :=true;
InitPubSetting();
end;
frmLogin.Close;
FreeAndNil(frmLogin);
end;
在工程单元里的MDIForm窗体创建前写
Application.CreateForm(TSysDBOp, SysDBOp);
if not UserLogin then
begin
freeandnil(SysDBOp);
Application.Terminate;
exit;
end;