DIEnumWbemClassObject.Next

[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
 

Parameters

lTimeout
Specifies the maximum time in milliseconds to wait until objects are available. If you use the value WBEM_INFINITE, this call will block until objects are available. If you use the value zero, the call immediately returns with whatever objects are waiting.
ppObject
DWbemClassObject type object. Serves as a container for returned object.

Return Values

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

Sample Code

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