函数参考


_EventLog__OpenBackup

打开一个日志文件备份的句柄

#Include <EventLog.au3>
_EventLog__OpenBackup($sServerName, $sFileName)

参数

$sServerName 打开日志的服务器的UNC名称,为空,本地机执行.
$sFileName 备份文件名称

返回值

成功: 日志文件备份的句柄
失败: 0

注意/说明

如果备份文件名指向一个远程服务器, $sServerName必须为空

相关

_EventLog__Close, _EventLog__Backup

示例/演示


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

Global $iMemo

_Main()

Func _Main()
    Local $hEventLog

    ; 创建 GUI
    GUICreate("EventLog", 400, 300)
    $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

    $hEventLog = _EventLog__Open("", "Application")
    _EventLog__Backup($hEventLog, "C:\EventLog.bak")
    _EventLog__Close($hEventLog)

    $hEventLog = _EventLog__OpenBackup("", "C:\EventLog.bak")
    MemoWrite("Log full ........: " & _EventLog__Full($hEventLog))
    MemoWrite("Log record count : " & _EventLog__Count($hEventLog))
    MemoWrite("Log oldest record: " & _EventLog__Oldest($hEventLog))
    _EventLog__Close($hEventLog)

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc   ;==>_Main

; 写入一行到 memo 控件
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite