6

有没有办法在生成“应用程序和服务”的事件时(在 C# 中)?我发现我不能为此使用 WMI。

还有其他想法吗?

4

2 回答 2

6

您可以订阅EventLog.EntryWritten 事件

在将条目写入本地计算机上的事件日志时发生。

来自 MSDN:

    ....
    EventLog myNewLog = new EventLog();
    myNewLog.Log = "MyCustomLog";                      

    myNewLog.EntryWritten += new EntryWrittenEventHandler(MyOnEntryWritten);
    myNewLog.EnableRaisingEvents = true;                 

}       

public static void MyOnEntryWritten(object source, EntryWrittenEventArgs e){

}
于 2012-04-12T19:25:28.647 回答
1

您是否尝试过EventLog.EntryWritten Event

于 2012-04-12T19:25:17.463 回答