Функция для очистки логов Windows (Delphi)
procedure ClearWindowLogs;
var hnd: THandle;
begin
// System
hnd := OpenEventLog(nil, 'System');
if hnd <> 0 then
try
ClearEventLog(hnd, nil);
finally
CloseEventLog(hnd);
end;
// Application
hnd := OpenEventLog(nil, 'Application');
if hnd <> 0 then
try
ClearEventLog(hnd, nil);
finally
CloseEventLog(hnd);
end;
// Security
hnd := OpenEventLog(nil, 'Security');
if hnd <> 0 then
try
ClearEventLog(hnd, nil);
finally
CloseEventLog(hnd);
end;
end;
Tags: ClearEventLog, Eventlog, очистка логов

