Public Sub WriteEventLog(ByVal xi_strServerName _
As String, ByVal xi_strAppName As String, _
ByVal xi_enmLogType As enmLogType, ByVal _
xi_lngEventID As Long, ByVal _
xi_strEventLogName As String, ByRef _
xio_aEventText() As String)
Dim lngRtn As Long
Dim lngRegEvntLogHwnd As Long
Dim lngUserSid As Long
Dim lngNumMessages As Long
Dim strReplace As String
Dim strServerName As String
If Trim$(xi_strServerName) = vbNullString Then
strServerName = vbNullString
Else
If Left$(Trim$ (xi_strServerName), 2) _
<> "\\" Then
strServerName = "\\" & xi_strServerName
Else
strServerName = xi_strServerName
End If
End If
lngNumMessages = CLng(TranslateArray _
(xio_aEventText(),m_typMessages))
lngRegEvntLogHwnd = RegisterEventSource _
(strServerName, xi_strAppName)
If lngRegEvntLogHwnd = 0 Then
' Raise an error
End If
lngUserSid = GetSid()
lngRtn = ReportEvent _
lngRegEvntLogHwnd, xi_enmLogType, _
m_lngCategory, xi_lngEventID, lngUserSid, _
lngNumMessages, m_lngLenRawData, _
m_typMessages, m_abytDataBuffer(0))
If lngRtn = False Then
' Raise an error
End If
lngRtn = DeregisterEventSource (lngRegEvntLogHwnd)
If lngRtn = False Then
' Raise an error
End If
End Sub
|