Function Reference


_EventLog__Open

Opens a handle to the event log

#include <EventLog.au3>
_EventLog__Open ( $sServerName, $sSourceName )

Parameters

$sServerName The UNC name of the server on where the event log will be opened. If blank, the operation is performed on the local computer.
$sSourceName The name of the log

Return Value

Success: the handle to the event log.
Failure: 0.

Remarks

To close the handle to the event log, use the _EventLog__Close().

Related

_EventLog__Clear, _EventLog__Close, _EventLog__Read, _EventLog__Report

Example

#include <EventLog.au3>
#include <GUIConstantsEx.au3>

Global $g_idMemo

Example()

Func Example()
    Local $hEventLog

    ; Create GUI
    GUICreate("EventLog", 400, 300)
    $g_idMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    $hEventLog = _EventLog__Open("", "Application")
    MemoWrite("Log full ........: " & _EventLog__Full($hEventLog))
    MemoWrite("Log record count : " & _EventLog__Count($hEventLog))
    MemoWrite("Log oldest record: " & _EventLog__Oldest($hEventLog))
    _EventLog__Close($hEventLog)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>Example

; Write a line to the memo control
Func MemoWrite($sMessage)
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite