怎么让delphi自己捕捉出错信息? 怎么让delphi自己捕捉出错信息? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try excepton E:exception//do exceptionend 我不太明白,能不能写清楚点啊?比如吧出错的信息显示在showmessage中。 delphi有捕捉异常的机制,如楼上所说的一样。 try excepton E:Echildenexception do begin //something; showmessage(E.message); end; . . .on E:Exception do begin //something; showmessage(E.message); end;end意外捕捉要从子类开始 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; 我把showmessage(E.message);换成Application.MessageBox(E.message); 怎么不成功?出错“incompatible type :'string' and 'pchar'”. Application.MessageBox(Pchar(E.message)); delphi 文件流中查找字符串 delphi下如何给JPG图片添加文字水印呢? CommaText 在progressbar中怎么显示百分比 画半透明图 activex destroy事件不响应 简单问题,在线等…… 一个简单的问题,如何显示进度? 数据删除的问题? 为什么我的程序不能设断点? 江湖急救:会者不难。关于ReportMachine求和的问题。(在线给分) 今晚把上两个月的几十个帖子都结了,再放分100, 祝CSDN人气越来越旺,也希望各位,尽快结贴,讲点诚信~~~跟帖有分!!
except
on E:exception
//do exception
end
比如吧出错的信息显示在showmessage中。
except
on E:Echildenexception
do
begin
//something;
showmessage(E.message);
end;
.
.
.
on E:Exception
do
begin
//something;
showmessage(E.message);
end;
end意外捕捉要从子类开始
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;
换成Application.MessageBox(E.message); 怎么不成功?出错“incompatible type :'string' and 'pchar'”.