procedure OpenChildForm(FormClass: TFormClass; var Fm; AOwner:TComponent);
var
I: Integer;
Child: TForm;
begin
for I := 0 to Screen.FormCount - 1 do
if Screen.Forms[I].ClassType = FormClass then
begin
Child := Screen.Forms[I];
if Child.WindowState = wsMinimized then
ShowWindow(Child.Handle, SW_SHOWNORMAL)
else
ShowWindow(Child.handle,SW_SHOWNA);
if (not Child.Visible) then Child.Visible := True;
Child.BringToFront;
Child.Setfocus;
TForm(Fm) := Child;
Exit;
end;
Child := TForm(FormClass.NewInstance);
TForm(Fm) := Child;
Child.Create(AOwner);
end;
本文地址:http://com.8s8s.com/it/it5052.htm