DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: lisz2024
今日帖子: 0
在线用户: 6
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 wwzjx123 (ww zjx) ★☆☆☆☆ -
普通会员
2024/4/29 15:38:57
标题:
如何讀取windows工作排程的執行歷程(執行日誌)記錄? 浏览:205
加入我的收藏
楼主: 如何讀取windows工作排程的執行歷程(執行日誌)記錄?
此帖子包含附件:
PNG 图像
大小:118.4K
----------------------------------------------
SPAM
作者:
男 iamdream (银河恒久远,梦想无止境!) ★☆☆☆☆ -
大贡献会员
2024/4/30 16:18:26
1楼: 百度来的,不知道是不是你想要的:
uses
  Windows, SysUtils, EventLog;
 
procedure TForm1.ReadEventLog;
var
  EventLog: TEventLog;
  EventLogRec: TEventLogRecord;
  EventLogHandle: THandle;
begin
  EventLogHandle := OpenEventLog('', 'System'); // 打开系统事件日志
  if EventLogHandle = 0 then
    RaiseLastOSError;
 
  try
    EventLog := TEventLog.Create(nil);
    try
      EventLog.LogHandle := EventLogHandle;
      EventLog.ReadAllRecords;
 
      while EventLog.ReadNextRecord do
      begin
        EventLogRec := EventLog.EventLogRecord;
        // 输出事件日志记录到控制台
        Writeln('Entry Type: ', EventLogRec.EntryType);
        Writeln('Record Number: ', EventLogRec.RecordNumber);
        Writeln('Time Generated: ', EventLogRec.TimeGenerated);
        Writeln('Time Written: ', EventLogRec.TimeWritten);
        Writeln('Event ID: ', EventLogRec.EventID);
        Writeln('Event Type: ', EventLogRec.EventType);
        Writeln('Source Name: ', EventLogRec.SourceName);
        Writeln('Category: ', EventLogRec.Category);
        Writeln('Event User: ', EventLogRec.EventUserName);
        Writeln('Computer: ', EventLogRec.ComputerName);
        Writeln('Description: ', EventLogRec.EventData);
        Writeln;
      end;
    finally
      EventLog.Free;
    end;
  finally
    CloseEventLog(EventLogHandle); // 关闭事件日志句柄
  end;
end;
----------------------------------------------
-广袤璀璨的银河,永无止境的梦想(梦无止境游银河) 博客挂了……
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.06836毫秒 RSS