AddListItem

AddListItem 是一個允許指令碼向使用者傳回回饋的函數。 該函數將新增傳遞給它的任何字串作為觸發弱點的一個子節點。 AddListItem 函數具有 2 個不同的參數。 第一個參數指定父節點,第二個參數是要新增到樹中的字串。 如果父節點左側為空,該函數會將指定字串新增到頂部的可用節點(弱點父節點)。 即使樹可以根據需要具有很多同級節點,但只能有 1 個等級。

語法

AddListItem(String,String)

結果

不適用

範例
Function MAIN
     Dim wmi As Object
     Dim objset As Object
     Dim obj As Object
     Dim monitor As Object
     Dim prop As Object
     Set wmi = GetObject("winmgmts:\\127.0.0.1\root\cimv2")
     Set objset = wmi.instancesof("Win32_service")
     For Each obj In objset
          Set monitor = obj
          For Each prop In monitor.properties_
               If VarType(prop.value) = 8 Then
               If Not (IsNull(prop.value)) Then
               If prop.name = "Name" Then
               If left(prop.value,1) = "a" then
                    AddListItem("A",prop.value)
               End If
               If left(prop.value,1) = "b" then
                    AddListItem("B",prop.value)
               End If
               If left(prop.value,1) = "c" Then
                    AddListItem("C",prop.value)
               End if
               End If
               End If
               End If
          Next
          Next
     main = true
End Function