Article ID: 161283
Article Last Modified on 5/13/2003
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Function GetVersionExA Lib "kernel32" _
(lpVersionInformation As OSVERSIONINFO) As Integer
Private Sub Form_Click()
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
'Log an Event before setting LogPath:
App.LogEvent "Event1", vbLogEventTypeError
Print "LogPath before StartLogging: " & App.LogPath
'Use StartLogging to set LogPath:
App.StartLogging "c:\MyEventLog.txt", vbLogAuto
Print "LogPath after StartLogging: " & App.LogPath
'Log another Event, after setting LogPath:
App.LogEvent "Event2", vbLogEventTypeError
'If Windows 95 or 98:
If osinfo.dwPlatformId = 1 Then
Print "Logged 'Event1' in " & _
Environ("windir") & "\vbevents.log"
Print "Logged 'Event2' in LogPath (" & App.LogPath & ")"
'If Windows NT:
ElseIf osinfo.dwPlatformId = 2 Then
Print "Logged 'Event1' & 'Event2' in the NT Event Log."
End If
End Sub
Additional query words: event log App default VBEVENTS.LOG unattended
Keywords: kbinfo KB161283