方法有三:
1: 在dpr中修改:
begin
if Login = true then
begin
application.initialize;
application.createform(...);
....
application.run;
end;
end;
2. 在主窗体的OnCreate事件中:
procedure TmainForm.Oncreate(....);
begin
if Not Login(...) then
Halt(1)
else
......
end;
3.将2中的Halt(1)该为Application.terminate,也行,只是有时窗口会闪一下.