Write to the Event Viewer

Category:
Miscellaneous
Type:
Classes
Difficulty:
Intermediate
Author:

John Conwell

Version Compatibility: Visual Basic 6, Visual Basic 5

More information:
This .dll will allow you to write to the Event Viewer. This is not new functionality, but if you use the windows API or VB's logging functionality you dont get full control over every field. This dll will let you pick all 5 severity levels, fill in your own event source, pick which server/pc to log to (you can log events to other servers), and pick your own Category and Event numbers. If you leave out the server name in the input parms it will use an API to pull the machine name of the one your using. If you leave out the Category number it will log "None" and of you leave out the Event number it will log 1. The biggest advantage of using this is the ability to put the application source in the Event Viewer. The VB log function will not allow you to do this.

The application works by shelling to a command line utility that writes to the event viewer. This utility is included in the package. See the two readme files for more information.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download eventlogger.zip