Delphi中异常捕获的简单应用

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    btn1: TButton;
    procedure getdeugbtn(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.getdeugbtn(Sender: TObject);
begin
  try
   asm
     xor eax,eax
     mov dword ptr[eax],0
   end
   except
   MessageBoxa(0,'错误到我这里来了','Sellcode',0);
   Exit;
   end;
end;

end.
原文地址:https://www.cnblogs.com/qq32175822/p/3141272.html