在主程序里打开一个子窗口,主窗口没关闭,此时我想通过点子窗口的一个按钮来关闭该子窗口,同时打开另一个子窗口,用了如下代码:
  fl_restore:=Tfl_restore.Create(self);
  fl_restore.Show;
  fl_brinfor.Close;
fl_restore是我想打开的窗口,fl_brinfor是我想关闭的窗口,现在问题是fl_brinfor.Close时把fl_restore也关闭了。我想的是fl_restore能够保留。
请高手帮忙。

解决方案 »

  1.   

    fl_restore:=Tfl_restore.Create(Application);
      

  2.   

    fl_restore:=Tfl_restore.Create(nil);
    也行
      

  3.   

    fl_restore:=Tfl_restore.Create(Application);
     fl_restore.Show;
     fl_brinfor.Close;
      

  4.   

    如果的Modal窗口,自己可处理释放,如:var
      

  5.   

    对不起,按错了,接上:如果的Modal窗口,自己可处理释放,如:begin
        '自己加异常处理;
        with TForm.Create(Application) do begin
            ShowModal;
            Free;
        end; 
    end;如果不是模式窗口,处理Form的Close事件,使Action := caFree;
      

  6.   

    fl_restore:=Tfl_restore.Create(nil);
    fl_restore.Show;
    fl_brinfor.Close;向导式用TPageControl多好啊
    用TTabSheet来管理页面
    毕竟这类操作的耦合度比较强
      

  7.   

    请问怎么才能完全释放窗口的内存。用.Close好像不行。
      

  8.   

    处理Form的Close事件,使Action := caFree;
      

  9.   

    直接调用Api,发送WM_CLOSE消息
    const 
    var 
      int1,int2,Wm_close:integer;
    begin
      ... ...
      Wm_close=16;
      Sendmessage(from.handle,Wm_close,int1,int2);
      ... ...
    end;