IWbemContext::Next

[This is preliminary documentation and subject to change.]

The IWbemContext::Next method

HRESULT Next(
  [in] LONG lFlags,
  [out] BSTR *pbstrName,
  [out] VARIANT *pValue 
);
 

Parameters

lFlags
Reserved. It must be zero.
pbstrName
This parameter cannot be NULL. If no error code is returned, it is set to point to a newly allocated BSTR.

The caller must call SysFreeString on the returned string when it is no longer required. If WBEM_S_NO_MORE_DATA is returned, pbstrName is set to point to NULL, in which case SysFreeString should not be called.

Note  If pbstrName points to a valid BSTR on entry, this BSTR is not freed, and a memory leak will occur.

pValue
This parameter cannot be NULL, and it must point to an uninitialized VARIANT. If no error is returned, the VARIANT is initialized using VariantInit. Then the VARIANT is set to contain the context value. The caller must call VariantClear on this pointer when the value is no longer required. If an error code is returned, the VARIANT pointed to by pValue is left unmodified.

If WBEM_S_NO_MORE_DATA is returned, this parameter is set to point to a VARIANT of type VT_NULL.

It is possible that an entire IWbemClassObject is returned inside the VARIANT. If that is the case, then VT_DISPATCH is the VARIANT type. The caller can take the IDispatch pointer and execute QueryInterface to obtain the IWbemClassObject pointer.

Note  At the end of the enumeration, WBEM_S_NO_MORE_DATA is returned. The returned VARIANT is of type VT_NULL, and the returned pbstrName is NULL.

Return Values

WBEM_E_INVALID_PARAMETER An invalid parameter was specified, or the namespace could not be parsed.
WBEM_E_UNEXPECTED Caller did not call IWbemContext::BeginEnumeration.
WBEM_NO_ERROR Success.
WBEM_S_NO_MORE_DATA No more properties are left in the enumeration.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the call.

See Also

IWbemContext::BeginEnumeration, IWbemContext::EndEnumeration