Platform SDK: Windows Management Instrumentation

IWbemContext::GetValue

The IWbemContext::GetValue method is used to retrieve a specific named context value by name.

HRESULT GetValue(
  LPCWSTR strName,
  LONG lFlags,
  VARIANT *pValue 
);

Parameters

strName
[in] Name for which the value is to be retrieved. This must point to a valid BSTR. The pointer is treated as read-only.
lFlags
[in] Reserved. It must be zero.
pValue
[out] This parameter cannot be NULL and must point to an uninitialized VARIANT. If no error is returned, the VARIANT is initialized using VariantInit, and then 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.

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

Return Values

This method returns an HRESULT object that indicates the status of the method call.

Value Meaning
WBEM_E_NOT_FOUND The requested value was not found.
WBEM_E_INVALID_PARAMETER An invalid parameter was specified.
WBEM_E_OUT_OF_MEMORY There was not enough memory to complete the operation.
WBEM_S_NO_ERROR The call succeeded.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later (with DCOM).
  Header: Declared in Wbemcli.h; include Wbemidl.h.
  Library: Use Wbemuuid.lib.

See Also

IWbemContext::SetValue