本帖最后由 leon460 于 2011-7-13 15:27 编辑
原版的_EventLog__Read返回只能返回一条记录?想做成返回所有的记录存于数组的形式,可惜啊,自己能力不够,有会的人 顶下哇
或者指定返回的项目也可以
如下图,可以返回所有的EVENT ID为52236并存于一个数组中吗?
多谢,多谢。#include <GuiConstantsEx.au3>
#include <EventLog.au3>
Global $iMemo
$ttt=1
_Main()
MsgBox(0,"",$ttt)
Func _Main()
Local $hEventLog, $aEvent
; Create GUI
GUICreate("EventLog", 400, 300)
$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 300, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
; Read most current event record
;$hEventLog = _EventLog__Open("", "Application")
;$aEvent = _EventLog__Read($hEventLog, True, False) ; read last event
$hEventLog = _EventLog__Open("", "System")
;$aEvent = _EventLog__Read($hEventLog)
$aEvent = _EventLog__Read($hEventLog, True, False)
If $aEvent[6]=7036 Then
$ttt+=$ttt
EndIf
MemoWrite("Result ............: " & $aEvent[0])
MemoWrite("Record number .....: " & $aEvent[1])
MemoWrite("Submitted .........: " & $aEvent[2] & " " & $aEvent[3])
MemoWrite("Generated .........: " & $aEvent[4] & " " & $aEvent[5])
MemoWrite("Event ID ..........: " & $aEvent[6])
MemoWrite("Type ..............: " & $aEvent[8])
MemoWrite("Category ..........: " & $aEvent[9])
MemoWrite("Source ............: " & $aEvent[10])
MemoWrite("Computer ..........: " & $aEvent[11])
MemoWrite("Username ..........: " & $aEvent[12])
MemoWrite("Description .......: " & $aEvent[13])
_EventLog__Close($hEventLog)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main
; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
|