不好意思,前段时间出差了.是这样的,主要是这段回调函数
/// <summary>
/// 定位产生日志的单元及行数
/// </summary>
/// <author> </author>
/// <date> 2006-8-5 </date>
unit AssertLogs;
interface
var
runErrMsg: string;
implementation
uses
Windows,
SysUtils;
var
//runErrMsg: string;
oldAssertErrorProc: TAssertErrorProc;
procedure LogAssert(const message, Filename: string; LineNumber: Integer;
ErrorAddr: Pointer);
begin
runErrMsg := '';
runErrMsg := Format('Addr: %p, in file(%d): %s', [ ErrorAddr, LineNumber, Filename]);
runErrMsg := Format('Error: %s, Addr: %p, in file(%d): %s',
[message, ErrorAddr, LineNumber, Filename]);
if IsConsole then
Writeln(runErrMsg)
else
MessageBox(0, PChar(runErrMsg), 'Error Log by AssertLogs', 0);
end;
initialization
oldAssertErrorProc := AssertErrorProc;
AssertErrorProc := @LogAssert;
finalization
AssertErrorProc := oldAssertErrorProc;
end.