문제

Is there a way to watch events of "applications and services" when they are generated (in C#)? I've figured out that I can not use WMI for it.

Any other ideas?

도움이 되었습니까?

해결책

You can subscribe to EventLog.EntryWritten Event

Occurs when an entry is written to an event log on the local computer.

From MSDN:

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

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

}       

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

}

다른 팁

Did your try it wit the EventLog.EntryWritten Event?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top