在主窗体类的 private 属性内定义这个过程
procedure Onexception(Sender: TObject; E: Exception);
procedure TMainFrm.Onexception(Sender: TObject; E: Exception);
begin
//...做你想做的
Abort;
end;在主窗体的OnCreate 事件加入这句话.
Application.OnException := Onexception;
好了,执行 exe,不要在调试状态下.一般的错误肯定不见了很恐怖.这里有异常的讨论,你去看看。
http://www.csdn.net/expert/Topic/42174.shtm
procedure Onexception(Sender: TObject; E: Exception);
procedure TMainFrm.Onexception(Sender: TObject; E: Exception);
begin
//...做你想做的
Abort;
end;在主窗体的OnCreate 事件加入这句话.
Application.OnException := Onexception;
好了,执行 exe,不要在调试状态下.一般的错误肯定不见了很恐怖.这里有异常的讨论,你去看看。
http://www.csdn.net/expert/Topic/42174.shtm
如
while a do
begin
try
//{your sentence}
finally
//do nothing...
end;
end;
在调试环境下用try...except 程序会报异常,并中止,
但如果你直接运行编译好的 EXE文件程序就不会中止.
try
...
except
on exception do
...
end;