var Forma:TForm1;
begin
Application.Initialize;
Application.CreateForm(TForm2, Form2); //create main form
Form1:=TForm1.Create(Application); //create password form
if Forma.ShowModal=MrOK then begin //由PASSOWRD的返回值决定是否继续。
Application.CreateForm(TForm3, Form3);
.....//Create other form
Application.Run;
end;
Form1.Free;
end.
(1):
function TFormmain.findchild(prform:string):Boolean;
var
i:integer;
begin
result:=False;
for i:=0 to MDIChildCount-1 do
if (uppercase(MDIChildren[i].name)=prform) then
begin
result:=True;
MDIChildren[i].BringToFront;
//MDIChildren[i].setfocus;
//MDIChildren[i].Activate;
if MDIChildren[i].windowstate=wsMinimized then ShowWindow(MDIChildren[i].handle,SW_RESTORE);
break;
end;
end;
在菜单项下面写:
if not findchild(uppercase('formname')) then //给出表单名字。
form1:=tfrom1.create(nil);