delphi 捕捉屏幕异常特殊处理

来源:互联网 发布:单片机模拟串口程序 编辑:程序博客网 时间:2024/06/07 19:34

Application.OnException := BSException;//异常捕捉


procedure TfmClient.BSException(Sender: TObject; E: Exception);
begin
  // EOSError  System Error.  Code: 5. 拒绝访问。.
  if  Pos('System Error.  Code: 5.',e.Message) > 0 then
    abort;
  //由于窗体在数据未取到时关闭,就会出在该模块的地址错误。
  if  Pos('dsnap70.bpl',e.Message) > 0 then
    abort;
  if  Pos('Cannot create form. No MDI forms are currently active',e.Message) > 0 then
    halt;
  ShowMessage(e.Message);  //弹出异常信息
end;

原创粉丝点击