在一个多文档程序里,想关闭子窗口(但用户可以取消关闭),如何判断子窗口是否关闭成功了?我使用下面方法,有时成功,要是不行,请问为什么,谢谢!function TMainForm.CloseAll:boolean;
var i : integer;
begin
  Result := True;
  if MdiChildCount > 0 then
     for i := MdiChildCount-1 downto 0 do begin
         MdiChildren[i].Close;
         Application.ProcessMessages;
         if MdiChildren[i] <> nil then begin
            Result := False;
            Break;
         end;
     end;
end;