我用了以下几行代码强制关闭,还是不行,
如果不用以下几行代码,在关闭应用程序的时候,就会抛出一个错误,
如果用了以下几行代码,就关闭正常,但是进程依然活动
procedure TProCliFrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  try
     ProCliFrm.free;
   // AcTion:=CaFree;
  except
    showmessage('确认关闭');
  end;
end;procedure TProCliFrm.FormDestroy(Sender: TObject);
begintry
  ProCliFrm:=Nil;
except
   showmessage('确认关闭吗');
end;
end;

解决方案 »

  1.   

    application.ter....
    后面的忘记了,你可以试一下!
    这是程序结束的意思!
      

  2.   

    关门主窗口并不保证能正常终止程序,用以下语句:
    application.ternimate;
      

  3.   

    TO:yeyuboy(海绵) 
    按你的办法试过了,
    还是不行,抛出一个错误:"Access violation at address 004c3064 in module procli.exe"
      

  4.   

    showmessage('确认关闭');//你应该是想用messagebox();,messagedlg();
    我想你的程序没被完全关闭,应该是还有资源没有释放。你把所有的程序检查一遍。看是不是有这种情况。
      

  5.   

    和我那个问题本质一样!http://community.csdn.net/Expert/topic/3426/3426467.xml?temp=.5273096
      

  6.   

    procedure TProCliFrm.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      try
         ProCliFrm.free;
       // AcTion:=CaFree;
      except
        showmessage('确认关闭');
      end;
    end;
    procedure TProCliFrm.FormDestroy(Sender: TObject);
    begintry
      ProCliFrm:=Nil;
    except
       showmessage('确认关闭吗');
    end;
    end;类对象释放自己是个愚蠢的做法,将导致内存泄漏;
    这么写也不符合OO思想