Y
ylj017
Unregistered / Unconfirmed
GUEST, unregistred user!
我想在线程中发生的所有 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
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