• XbReportEvent(nEvtHandle, [nType], [nEvtID], cEvtString)


    • Description
      This function is used to log an event.
      The entry is written to the end of the configured logfile for the source identified by
      the hEventLog parameter. The ReportEvent function adds the time, the user name,
      the entry’s length, and the offsets before storing the entry in the log.

    • Parameter(s)

      nEvtHandle
      Identifies the event log whose handle was returned by XbRegEventSource.

      nType
      Specifies the type of event being logged.
      This parameter can be one of the following values:

      Value   Meaning
      EVENTLOG_ERROR_TYPE   Error event
      EVENTLOG_WARNING_TYPE   Warning event
      EVENTLOG_INFORMATION_TYPE   Information event
      EVENTLOG_AUDIT_SUCCESS   Success Audit event
      EVENTLOG_AUDIT_FAILURE   Failure Audit event


      nEvtID
      Specifies the event identifier. The event identifier specifies the message that goes
      with this event as an entry in the message file associated with the event source.

      cEvtString
      Points to a buffer containing an string that are merged into the message before
      Event Viewer displays the string to the user.

    • Return Value
      If the function succeeds, the return value is TRUE, otherwise FALSE.
      To get extended error information, call XbEventGetLastError.
  • Sample
    #include "xbevent.ch"

    local nEvtHandle    := 0
    local cError        := space(100)

    //
    // open a Eventlog-Key
    //
    if ((nEvtHandle := XbRegEventLog(, "WinApp")) <= 0)
      XbEventGetLastError(@cError)
      ? "Error :", cError
    else
      XbReportEvent(nEvtHandle, nType, nEvtID, cEvtString)
      XbDeRegEventLog(nEvtHandle)
    endif