Simple example:-HANDLE changed = CreateEvent ( NULL, FALSE, FALSE, NULL ); HANDLE event_log = OpenEventLog ( machine_name, application_system_or_security ); // put in some checks that everything above has worked if ( NotifyChangeEventLog ( event_log, changed ) ) { while ( WaitForSingleObject ( changed, INFINITE ) == WAIT_OBJECT_0 ) { // the event log has changed, so do something // probably want some other way to exit the loop too } } CloseEventLog ( event_log ); CloseHandle ( changed );
HANDLE event_log = OpenEventLog ( machine_name,
application_system_or_security );
// put in some checks that everything above has worked
if ( NotifyChangeEventLog ( event_log, changed ) )
{
while ( WaitForSingleObject ( changed, INFINITE ) == WAIT_OBJECT_0 )
{
// the event log has changed, so do something
// probably want some other way to exit the loop too
}
}
CloseEventLog ( event_log );
CloseHandle ( changed );
changed是不是一个EventLog对象,它主要起一个什么作用。