
16.11.2012, 11:56
|
 |
Let Me Show You
|
|
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
|
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure ExceptionEvent(Sender: TObject; E: Exception);
procedure DoCheck;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnException:=ExceptionEvent;
end;
procedure TForm1.ExceptionEvent(Sender: TObject; E: Exception);
begin
// ShowMessage(E.Message);
end;
procedure TForm1.DoCheck;
begin
if True then raise Exception.Create('Oops');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
DoCheck;
end;
end.
но с Exit красивее
__________________
Пишу программы за еду.
__________________
|