为何abort不起作用?
明明是false但窗口 DmmForm 还是显示出来了?
有没办法改进?谢了.....
procedure TMainForm.N38Click(Sender: TObject);
begin
    CheckLeave(2);//调用下方函数
    DmmForm.Show;
end;
//检查权限
procedure CheckLeave(I:Integer);
begin        if trim(pub.LoginUserBorrow)='false' then
        begin
            ShowMessage('您没有浏览权限.');
            exit;
            abort;        
        end;
end;

解决方案 »

  1.   

    你的程序先执行了Exit了,当然abort不起作用了。
      

  2.   

    都已经exit了,就不会再执行abort了。
    你可以把CheckLeave变成一个function,返回值是Boolean型,没有权限就返回false。
    调用处可以 
       if CheckLeave(I: Integer) then
          DmmForm.Show;
      

  3.   

    不是啊..这是我测试时加了一个exit.没加exit也不行...没天理啊...
      

  4.   


    知道了..先ABORT;
    再EXIT;
      

  5.   

    Abort只在本函数内起作用(即使有好多层),如果全局都起作用,还不整个都Abort了?
      

  6.   

    看看Abort是做什么用的?
    明白点说就是:即使有异常,也忽略异常继续执行后面的任务,且不显示异常信息给最终用户!DescriptionUse Abort to escape from an execution path without reporting an error.Abort raises a special "silent exception" (EAbort), which operates like any other exception, but does not display an error message to the end user.  Abort redirects execution to the end of the last exception block.