Valhalla Legends Archive

Programming => General Programming => Visual Basic Programming => Topic started by: Grok on September 09, 2003, 12:26 PM

Title: Event Log class from VB
Post by: Grok on September 09, 2003, 12:26 PM
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?
Title: Re:Event Log class from VB
Post by: Adron on September 09, 2003, 02:15 PM
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.
Title: Re:Event Log class from VB
Post by: Grok on September 09, 2003, 05:16 PM
It's what we're stuck with.
Title: Re:Event Log class from VB
Post by: Hazard on September 09, 2003, 08:00 PM
Quote from: Grok on September 09, 2003, 05:16 PM
It's what we're stuck with.

We have it tough.
Title: Re:Event Log class from VB
Post by: Grok on September 09, 2003, 08:44 PM
Quote from: Hazard on September 09, 2003, 08:00 PM
Quote from: Grok on September 09, 2003, 05:16 PM
It's what we're stuck with.

We have it tough.

Who is "we"?
Title: Re:Event Log class from VB
Post by: Hazard on September 10, 2003, 03:16 PM
Quote from: Grok on September 09, 2003, 08:44 PM
Quote from: Hazard on September 09, 2003, 08:00 PM
Quote from: Grok on September 09, 2003, 05:16 PM
It's what we're stuck with.

We have it tough.

VB programmers in general.

Who is "we"?
Title: Re:Event Log class from VB
Post by: Adron on September 10, 2003, 06:15 PM
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.
Title: Re:Event Log class from VB
Post by: Grok on September 10, 2003, 07:06 PM
That sounds effective, I'll try it.