您的位置:首页 > 编程语言 > Delphi

清除系统日志的Delphi代码

2007-02-25 20:20 399 查看
主要是从网上一段VB程序转化而来,其实代码很简单,只不过之前不知道有OpenEventLog这类的API函数。

//====================清除事件记录=======by liswa=================
function KillEventLog(EventName:String):boolean;
var
HEvent:Hwnd;
begin
HEvent:=OpenEventLog(nil,pchar(EventName));
if HEvent=0 then
begin
Result:=false;
exit;
end;
if ClearEventLog(HEvent,nil) then
begin
Result:=false;
exit;
end;
result:=CloseEventLog(HEvent);

end;
procedure DelEventLog;
var
HEvent:hwnd;
begin
KillEventLog('Application');
KillEventLog('System');
KillEventLog('Security');
KillEventLog('SecEvent.Evt');
KillEventLog('SysEvent.Evt');
KillEventLog('DnsEvent.Evt');
end;

//=================ClearEventLog结束===================
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: