怎么让delphi自己捕捉出错信息?

解决方案 »

  1.   

    try 
    except
    on E:exception
    //do exception
    end
      

  2.   

    我不太明白,能不能写清楚点啊?
    比如吧出错的信息显示在showmessage中。
      

  3.   

    delphi有捕捉异常的机制,如楼上所说的一样。
      

  4.   

    try 
    except
    on E:Echildenexception
      do 
      begin 
          //something;
         showmessage(E.message);
      end;
     .
     .
     .
    on E:Exception
      do 
      begin 
          //something;
         showmessage(E.message);
      end;
    end意外捕捉要从子类开始
      

  5.   

    procedure TSysSession.RaiseException(Sender: TObject; E: Exception);
    var
        Msg: string;
    begin    Msg := '★运行《' + PROGRAM_NAME + '》发生了错误';
        Msg := Msg + #13 + '★您可以将以下的错误信息通知供应商:';
        Msg := Msg + #13'发生时间是' + FormatDateTime('yyyy年mm月dd日hh:nn:ss', Now);
        Msg := Msg + #13'发生组件是' + Sender.ClassName;    Msg := Msg + #13#13 + e.Message;
        Application.MessageBox(pchar(Msg),
            '运行错误', MB_IconError);end;
    constructor TSysSession.Create;
    begin
        Application.OnException := RaiseException;
    end;
      

  6.   

    我把showmessage(E.message);
    换成Application.MessageBox(E.message);  怎么不成功?出错“incompatible type :'string' and 'pchar'”.
      

  7.   

    Application.MessageBox(Pchar(E.message));