• Welcome to Valhalla Legends Archive.
 

Event Log class from VB

Started by Grok, September 09, 2003, 12:26 PM

Previous topic - Next topic

Grok

Visual Basic 6, NT Event Log

The NotifyChangeEventLog function enables an application to receive notification when an event is written to the specified event logfile. When the event is written to the event logfile, the specified event object is set to the signaled state.

When an event is written to the logfile specified by hEventLog, the system uses the PulseEvent function to set the event specified by the hEvent parameter to the signaled state. If the thread is not waiting on the event when the system calls PulseEvent, the thread will not receive the notification. Therefore, you should create a separate thread to wait for notifications.

****

How would anyone with experience recommend I do this from a self-contained VB class module?

Adron

That sounds like a stupid design. You can never know for sure that you haven't missed an event. An event could come in just after you finished processing the last one but before you get to wait for the event.

Grok


Hazard


"Courage is being scared to death - but saddling up anyway." --John Wayne


Hazard


"Courage is being scared to death - but saddling up anyway." --John Wayne

Adron

If you really care about getting the notifications, you should have a thread sit in a tight loop waiting for that event and setting another event or posting a message every time the first event is pulsed. You should try to ensure that the tight loop thread gets back to waiting before the second thread polls for the new message(s) in the event log.

Grok

That sounds effective, I'll try it.