• XbClearEventLog(nEvtHandle[, cBackupFileName])


    • Description
      this function clears the specified event log, and optionally saves the current copy
      of the logfile to a backup file.
    • Parameter(s)

      hEventLog
      Identifies the event log to be closed.
      This handle is returned by the XbOpenEventLog function

      cBackupFileName (optional)
      points to the string specifying the name of a file in which a current copy of the event
      logfile will be placed. If this file already exists, the function fails.
      The backup filename may contain a server name to save the backup file on
      a remote server. If the lpBackupFileName parameter is NIL, the current event logfile
      is not backed up.

    • Return Value
      If the function succeeds, the return value is TRUE.
      The specified event log has been backed up (if cBackupFileName is not NIL)
      and then cleared.
      If the function fails, the return value is FALSE.
      To get extended error information, call XbEventGetLastError.
  • Sample
    #include "xbevent.ch"

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

    //
    // open a Eventlog-Key and directly close key again
    //
    if ((nEvtHandle := XbOpenEventLog(, "WinApp")) <= 0)
      XbEventGetLastError(@cError)
      ? "Error :", cError
    else
      if (XbClearEventLog(nEvtHandle, "SaveLog.Evt")== FALSE)
        XbEventGetLastError(@cError)
        ? "Error :", cError
      endif
      XbCloseEventLog(nEvtHandle)
    endif