本帖最后由 dreamgg 于 2010-1-28 23:02 编辑
想列表出系统服务到日志文件,按照“ServiceControl.au3”内含例子里的方法总是报错,请赐教!#include <Array.au3>
Func _ServListInstalled($Computer = ".")
Local $Rtn = ''
$Service = ObjGet("winmgmts:\" & $Computer & "\root\cimv2")
$sItems = $Service.ExecQuery("Select * from Win32_Service")
For $objService in $sItems
$Rtn &= $objService.Name & '|'
Next
Return StringSplit(StringTrimRight($Rtn, 1), '|')
EndFunc
_ArrayDisplay(_ServListInstalled(),"test")
报错信息:
F:\My Documents\code\listserv\1.au3(25,42) : ERROR: _ArrayDisplay() called with expression on Const ByRef-param(s).
_ArrayDisplay(_ServListInstalled(),"test")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
H:\Tools\autoit3\Include\Array.au3(322,163) : REF: definition of _ArrayDisplay().
Func _ArrayDisplay(Const ByRef $avArray, $sTitle = "Array: ListView Display", $iItemLimit = -1, $iTranspose = 0, $sSeparator = "", $sReplace = "|", $sHeader = "")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
F:\My Documents\code\listserv\1.au3 - 1 error(s), 0 warning(s) |