我也有一个,很好啊!
procedure tfrmmain.CloseAllWindows;
var
I: Integer;
F: TForm;
begin
for I := 0 to Application.ComponentCount - 1 do
begin
if Application.Components is TForm then
begin
F := TForm(Application.Components);
if (F <> Self) and (F.Visible) then F.Close;
end;
end;
end;