In VB we can report events by the following method (Win NT and higher)

VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function GetVersion Lib "kernel32" () As Long
  4.  
  5. Private Const EVENTLOG_SEQUENTIAL_READ = &H1
  6. Private Const EVENTLOG_SEEK_READ = &H2
  7. Private Const EVENTLOG_FORWARDS_READ = &H4
  8. Private Const EVENTLOG_BACKWARDS_READ = &H8
  9.  
  10. Public Enum EventType
  11.     EError = &H1
  12.     EWarning = &H2
  13.     EInformation = &H4
  14.     ESuccess = &H0
  15.     EAuditSuccess = &H8
  16.     EAuditFailure = &H10
  17. End Enum
  18.  
  19. Private Declare Function OpenEventLog Lib "advapi32.dll" Alias "OpenEventLogA" (ByVal lpUNCServerName As String, ByVal lpSourceName As String) As Long
  20.  
  21. Private Declare Function ReportEvent Lib "advapi32.dll" Alias "ReportEventA" (ByVal hEventLog As Long, ByVal wType As EventType, ByVal wCategory As Long, ByVal dwEventID As Long, lpUserSid As Any, ByVal wNumStrings As Long, ByVal dwDataSize As Long, lpStrings As String, lpRawData As Any) As Long
  22.  
  23. Private Declare Function CloseEventLog Lib "advapi32.dll" (ByVal hEventLog As Long) As Long
  24.  
  25.  
  26. Dim hEventLog As Long, Details As String
  27.  
  28. Private Sub cmdreport_Click()
  29. If GetVersion() And &H80000000 Then
  30.         MsgBox "Event logging is not available in win 9X.", vbCritical, "Error(unavailable function)...!"
  31.     Else
  32.         Details = "Error"
  33.         hEventLog = OpenEventLog(vbNullString, Details)
  34.         ReportEvent hEventLog, EError, 0, 0, ByVal 0&, 1, 0, "Event Log test.", ByVal 0&
  35.         CloseEventLog hEventLog
  36. End If
  37. End Sub

This is fine but there is something missing , first looks to this picture



It say that the descripitor for event ........... cannot be found............. .

what my code need to report events as other windows applications that give full detalis about the error ?