IWbemContext::SetValue method (wbemcli.h)

The IWbemContext::SetValue method creates or overwrites a named context value.

Syntax

HRESULT SetValue(
  [in] LPCWSTR wszName,
  [in] long    lFlags,
  [in] VARIANT *pValue
);

Parameters

[in] wszName

Cannot be NULL. It is a read-only pointer that indicates the context value name. This value must be null-terminated.

[in] lFlags

Reserved. This parameter must be 0 (zero).

[in] pValue

Must point to a valid VARIANT, which is treated as read-only. The value in the VARIANT becomes the named context value. An entire IWbemClassObject object can be stored as well as a simple value by enclosing it in a VARIANT that uses the VT_UNKNOWN type. The caller must execute QueryInterface on the IWbemClassObject object by asking for IID_IUnknown, and by using the returned pointer in the VARIANT.

If pValue is to contain an embedded IWbemClassObject object, the caller must call IWbemClassObject::QueryInterface for IID_IUnknown and place the resulting pointer in the VARIANT by using a type of VT_UNKNOWN. The original embedded object is copied during the write operation, and so cannot be modified by the operation.

Return value

This method returns an HRESULT that indicates the status of a method call. The following list lists and describes the values contained in an HRESULT.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header wbemcli.h (include Wbemidl.h)
Library Wbemuuid.lib
DLL Esscli.dll; Fastprox.dll; FrameDyn.dll; FrameDynOS.dll; Wbemcomn.dll; Wbemcore.dll; Wbemess.dll; Wmipjobj.dll

See also

IWbemContext

IWbemContext::GetValue