服务端日志记录
procedure LogInfo(msg: string);
// 功能: 服务端日志
var
p: PChar;
begin
try
GetMem(p, (Length(msg) + 1) * sizeof(char));
Move(msg[1], p^, (Length(msg) + 1) * sizeof(char));
PostMessage(Application.MainForm.Handle, WM_LOG, integer(p), 0);
except
Exit;
end;
end;
procedure Tf_MainForm.Log(var msg: TMessage);
var
p: PChar;
begin
try
p := PChar(msg.WParam);
if Assigned(p) then
begin
AddMemo(p);
FreeMem(p);
end;
except
on E: Exception do
begin
LogInfo('Tf_MainForm.Log---' + E.Message);
exit;
end;
end;
end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/archive/2012/03/05/2381116.html