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;