Oggetto SWbemRefreshableItem

L'oggetto SWbemRefreshableItem rappresenta un singolo elemento in un oggetto SWbemRefresher . Un oggetto SWbemRefreshableItem viene ottenuto tramite i metodi Add e AddEnum di SWbemRefresher. Questo oggetto non può essere creato dalla chiamata CREATEObject VBScript.

Membri

L'oggetto SWbemRefreshableItem include questi tipi di membri:

Metodi

L'oggetto SWbemRefreshableItem include questi metodi.

Metodo Descrizione
Rimuovi Rimuove l'oggetto SWbemRefreshableItem dall'oggetto SWbemRefresher padre.

Proprietà

L'oggetto SWbemRefreshableItem ha queste proprietà.

Proprietà Tipo di accesso Descrizione
Indice
Lettura/Scrittura
Indice dell'elemento nell'oggetto SWbemRefresher padre.
Isset
Lettura/Scrittura
Indica se l'oggetto SWbemRefreshableItem rappresenta un singolo oggetto o un set di oggetti.
Oggetto
Lettura/Scrittura
Rappresenta un singolo oggetto SWbemObject aggiornato.
ObjectSet
Lettura/Scrittura
Rappresenta il set di oggetti da aggiornare.
Aggiornamento
Sola lettura
Rappresenta l'oggetto SWbemRefresher padre che contiene l'oggetto SWbemRefreshableItem .

Commenti

Il metodo VBScript GetObject non può essere usato per creare direttamente oggetti SWbemRefreshableItem .

Esempio

Lo script seguente illustra la creazione di un oggetto SWbemRefresher e l'aggiunta di un singolo oggetto e enumeratore SWbemRefreshableItem .

' Get some namespace connections
set cimv2 = GetObject("winmgmts:root\cimv2")
set default = GetObject("winmgmts:root\default")    

' Create a refresher
set refresher = CreateObject("WbemScripting.SWbemRefresher")

' Add a single object to the refresher.
' The @ is used because this is a singleton 
' system class so only one instance exists.
set item1 = refresher.Add (default, "__CIMOMIdentification=@").Object
MsgBox "WMI Version " item1
' Add an enumerator to the refresher.
' Note that the SWbemRefreshableItem.ObjectSet 
' property must be used to designate
' this as an object set rather than a single object.
set item2 = refresher.AddEnum (cimv2, "Win32_Process").ObjectSet

' Loop three times, refreshing the items

For I= 1 To 3
MsgBox "Refresh number " & I
refresher.Refresh

' Iterate through the collection of
' processes in item2 with name of wscript
    For each process in item2
        If process.name = "wscript.exe" then
        MsgBox "Process " & process.Name & _
           " Page Faults " & process.PageFaults
        End If
    Next 
Next

' Clear out the refresher
refresher.DeleteAll 

' The following should return 0
MsgBox "Number of items in Refresher after DeleteAll " _
    & refresher.Count

Requisiti

Requisito Valore
Client minimo supportato
Windows Vista
Server minimo supportato
Windows Server 2008
Intestazione
Wbemdisp.h
Libreria dei tipi
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemRefreshableItem
IID
IID_ISWbemRefreshableItem

Vedi anche

Scripting di oggetti API