如何让窗体1关闭而窗体2不关闭?
程序是这样的:用户输入密码,正确后form2.show 同时form1关闭,问 此时如何让form1关闭?(不想用form1.hide)
[解决办法]
project1.dpr
begin
Application.Initialize;
Application.CreateForm(TForm2, Form2);
Application.Run;
end;
Unit2.pas
uses Unit1;
procedure TForm2.FormShow(Sender: TObject);
begin
if not Assigned(form1) then form1 := TForm1.Create(nil);
if form1.ShowModal <> mrOk then ExitProcess(1);
FreeAndNid(form1)
end;