[This is preliminary documentation and subject to change.]
The DIEnumWbemClassObject.Clone method makes a logical copy of the entire enumerator. It retains its current cursor position.
Note You cannot clone any pending asynchronous deliveries begun by DIEnumWbemClassObject.NextAsync_hmm_DIEnumWbemClassObject.NextAsync.
Clone(
[out] ppEnum As Object
) As Long
WBEM_NO_ERROR | The call succeeded, and the enumerator has been cloned. |
WBEM_S_FALSE | The call failed, and no enumerator has been returned. |
For more information on return values see Visual Basic error handeling and return values
Function CloneEnum(pSrc As DIEnumWbemClassObject) As Boolean
Dim pCopy As DIEnumWbemClassObject
Dim Hres As Long '
hRes = pSrc.Clone(pCopy)
if (hRes <> WBEM_NO_ERROR) Then ' Failed to clone it
CloneEnum =FALSE
Endif
' Use the copy of the enumerator
' ...
Set pCopy = Nothing
CloneEnum = TRUE
End Function