我想在线程中发生的所有 Socket Error都捕捉起来 记录在一个件中procedure tfrmmain.LogException(Sender: TObject; E: Exception);
var
Filename: string;
LogFile: TextFile;
begin
Filename := ChangeFileExt (Application.Exename, '.log');
AssignFile (LogFile, Filename);
if FileExists (FileName) then
Append (LogFile) // open existing file
else
Rewrite (LogFile);
try
Writeln (LogFile, DateTimeToStr (Now) + ':' + E.Message);
if not CheckBoxSilent.Checked then
Application.ShowException (E);
finally
CloseFile (LogFile);
end;
end;上述代码就是不能捕捉线程Exception
var
Filename: string;
LogFile: TextFile;
begin
Filename := ChangeFileExt (Application.Exename, '.log');
AssignFile (LogFile, Filename);
if FileExists (FileName) then
Append (LogFile) // open existing file
else
Rewrite (LogFile);
try
Writeln (LogFile, DateTimeToStr (Now) + ':' + E.Message);
if not CheckBoxSilent.Checked then
Application.ShowException (E);
finally
CloseFile (LogFile);
end;
end;上述代码就是不能捕捉线程Exception
解决方案 »
- 关于数据记录复制插入的问题?
- 怎样将树型结构中的‘类,父类‘(如:A,B,C)按顺序放入数组中?急求指教
- dxGrid的Colums合计发生变化,是触发那个事件,,,求助啊。。。。
- 请问怎么判断输入的是不是数字呢?
- 用友问题
- d6和d7能够兼容吗?
- 三个问题,急待回答
- ms agent 2.0 在 w2k advServer下安装说 package is not cpmpatible with the version of your windows?怎么 回事
- 有关数据库列表多项选择的问题!
- 如何用delphi写VPN连接程序啊!
- 我在一个DLL1里封装了一个DataModule,DataModule包含所有数据感知控件和所有的数据控制控件,我怎样在另一个封装了MDIChild的DLL2里动态加
- 高手来看吧!太怪了。
如何控制一个线程的执行超时 我就要kill掉
在 Tmythread 中try
....
except
on E : Exception do
begin
tLogException(nil,E); //主窗口中的一个过程它的内容与LogException一样
end;
end;