unit SystemRunError;

interface

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

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

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: SystemRunError
// Routine: System.RunError

// BeginCode
{
This example demonstrates how to set a run error, the behavior of
execution and the message that follows.
}
var P: Pointer;

procedure TForm1.Button1Click(Sender: TObject);
begin
{$IFDEF Debug}
  if P = nil then
    RunError(204);
{$ENDIF}
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  P:= nil;
end;
// EndCode
// EndExample: SystemRunError
end.
