with TLogin.Create(Application) do try ShowModal; if 密码正确then Application.Createform(主窗口类, 主窗口变量) else Application.Ter....; finally free; end;密码可以保存在数据库.
把登陆窗口放DLL里 每次主窗口Create的时候调用
program Project1;uses Forms, Windows, Unit1 in 'Unit1.pas' {Form1};{$R *.RES} var FrmLogon: TForm;begin Application.Initialize; try FrmLogon := TForm.Create(Application); FrmLogon.Show; FrmLogon.Refresh; Sleep(1000); Application.CreateForm(TForm1, Form1); FrmLogon.Close; Application.Run; finally FrmLogon.Free; end;end. if Understand then EverythingIsOK;
try
ShowModal;
if 密码正确then
Application.Createform(主窗口类, 主窗口变量)
else
Application.Ter....;
finally
free;
end;密码可以保存在数据库.
Forms,
Windows,
Unit1 in 'Unit1.pas' {Form1};{$R *.RES}
var
FrmLogon: TForm;begin
Application.Initialize;
try
FrmLogon := TForm.Create(Application);
FrmLogon.Show;
FrmLogon.Refresh;
Sleep(1000);
Application.CreateForm(TForm1, Form1);
FrmLogon.Close;
Application.Run;
finally
FrmLogon.Free;
end;end.
if Understand then
EverythingIsOK;