About   -   Contact   -   Purchase   -   Search   -   What's New

Writing to the Windows NT Event Log
A useful feature to add to VB applications is the ability to write to the NT Event Log as a means of providing the user with information or warning of errors. The App object in both VB5/6, now provides event logging methods.
'-- Start Event Logging
Call App.StartLogging("", vbLogToNT)
'-- Log Events to NT
Call App.LogEvent("Info", vbLogEventTypeInformation) 
Call App.LogEvent("Error", vbLogEventTypeError)
Call App.LogEvent("Warning", vbLogEventTypeWarning)

A few points to note, these functions will only work in a compiled executable as the code is simply ignore in design mode, therefore you cannot use the code during a debug session. Apart from these limitations, these methods form a quick and simple method for event logging

If running on Windows 95, change the logmode argument in the 'App.StartLogging' function from 'vbLogToNT' to 'vbAutoLog'.


Top of Page

Legal Notice

Ken Howe 2011