[This is preliminary documentation and subject to change.]
The DIEnumWbemClassObject.Next method returns the next object, starting at the current cursor position. It then advances the cursor position by one object. Subsequent calls return the subsequent objects.
Next(
[in] lTimeOut As Long,
[out] ppObject As Object
) As Long
WBEM_NO_ERROR | The number of objects returned was the same as the number requested. |
WBEM_S_FALSE | No more objects are available. |
WBEM_S_TIMEDOUT | A timeout occurred before all the objects could be obtained. |
Remarks
For more information on return values see Visual Basic error handeling and return values.
In the following sample, objects are requested only one at a time. Because WBEM_S_FALSE is returned when there are no more objects available, you should check the return code for WBEM_NO_ERROR after retrieving each object
sub ListObjects(pEnum As DIEnumWbemClassObject)
pEnum.Reset
Dim pObject As DWbemClassObject
Dim uReturned As Long
While (pEnum.Next(WBEM_INFINITE, pObject) = WBEM_NO_ERROR)
pObject.… ' Access DWbemClassObject methods
Set pObject = Nothing
Wend
End Sub