G
GrassDragon
Unregistered / Unconfirmed
GUEST, unregistred user!
我的代码是这样的.
program Project;
...
begin
try
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
except
on e: exception do
begin
showmessage(e.Message);
Application.Terminate;
end;
end;
unit Unit1;
...
procedure TForm1.FormCreate(Sender: TObject);
var Open_File: TextFile;
begin
try
Rewrite(Open_File);
except
on e: exception do
raise exception.Create('test');
end;
end;
但是程序运行到"on e: exception do raise exception.Create('test');"一句时,仍然弹出标准的window错误提示窗口,并且不能被Project的try...Except所捕获我重引发的exception。
这是为什么?
我测试了一下,估计和Application有关。
program Project;
...
begin
try
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
except
on e: exception do
begin
showmessage(e.Message);
Application.Terminate;
end;
end;
unit Unit1;
...
procedure TForm1.FormCreate(Sender: TObject);
var Open_File: TextFile;
begin
try
Rewrite(Open_File);
except
on e: exception do
raise exception.Create('test');
end;
end;
但是程序运行到"on e: exception do raise exception.Create('test');"一句时,仍然弹出标准的window错误提示窗口,并且不能被Project的try...Except所捕获我重引发的exception。
这是为什么?
我测试了一下,估计和Application有关。