我有個打開mdi 窗口的function 你試一試.
//*************打開mdi子窗口******************//
//** 判別需要打開的窗口是否已經打開,只可打開一次.
//** 若已打開但為最小化,變為最大化,調為最前面.
//********************************************//
procedure TMainForm.Openmdiwin(Sender: TFormClass);
Var
iii:Integer;
Frm:TForm;
begin
For iii:=0 to MainForm.MDIChildCount-1 Do Begin
if MainForm.MDIChildren[iii].ClassType=Sender Then Begin
Frm:=MainForm.MDIChildren[iii];
if Frm.WindowState=wsMinimized then //為最小化
ShowWindow(Frm.handle,SW_SHOWNORMAL)
Else
ShowWindow(Frm.handle,SW_SHOWNA);
if (Not Frm.Visible) then Frm.Visible:=True;
Frm.BringToFront;
Frm.SetFocus;
Exit;
End;
End;
Frm:=TForm(Sender.NewInstance);
Frm:=Frm.Create(Self);
Frm.Show;
end;