Z
ztao1979
Unregistered / Unconfirmed
GUEST, unregistred user!
请问以下代码为什么在DELPHI2005 下会出错:
procedure TForm1.OpenForm(FormClass:TFormClass;var Fm;AOwner: TComponent);
var
i: Integer;
Child: TForm;
begin
for i:=0 to screen.FormCount-1 do
begin
if Screen.Forms.ClassType=FormClass then
begin
Child:=Screen.Forms;
if Child.WindowState=wsMinimized then
begin
ShowWindow(Child.Handle,SW_SHOWNORMAL)
end else
begin
ShowWindow(Child.Handle,SW_SHOWNA);
end;
if (not child.Focused) then
child.Visible:=True;
Child.BringToFront;
Child.SetFocus;
TForm(Fm):=Child;
exit;
end;
end;
child:=TForm(FormClass.NewInstance);
TForm(Fm):=Child;
Child.Create(AOwner);
Child.Left:=0;
Child.Top:=0;
end;
procedure TForm1.OpenForm(FormClass:TFormClass;var Fm;AOwner: TComponent);
var
i: Integer;
Child: TForm;
begin
for i:=0 to screen.FormCount-1 do
begin
if Screen.Forms.ClassType=FormClass then
begin
Child:=Screen.Forms;
if Child.WindowState=wsMinimized then
begin
ShowWindow(Child.Handle,SW_SHOWNORMAL)
end else
begin
ShowWindow(Child.Handle,SW_SHOWNA);
end;
if (not child.Focused) then
child.Visible:=True;
Child.BringToFront;
Child.SetFocus;
TForm(Fm):=Child;
exit;
end;
end;
child:=TForm(FormClass.NewInstance);
TForm(Fm):=Child;
Child.Create(AOwner);
Child.Left:=0;
Child.Top:=0;
end;