Expand Minimize

PropVariantGetDoubleElem function

Extracts a single double element from a PROPVARIANT structure of type VT_R8, VT_VECTOR | VT_R8, or VT_ARRAY | VT_R8.

Syntax


HRESULT PropVariantGetDoubleElem(
  _In_   REFPROPVARIANT propvar,
  _In_   ULONG iElem,
  _Out_  DOUBLE *pnVal
);

Parameters

propvar [in]

Type: REFPROPVARIANT

Reference to the source PROPVARIANT structure.

iElem [in]

Type: ULONG

Specifies vector or array index; otherwise, iElem must be 0.

pnVal [out]

Type: DOUBLE*

When this function returns, contains the extracted double value.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

If the source PROPVARIANT has type VT_R8, iElem must be 0. Otherwise iElem must be less than the number of elements in the vector or array. You can use PropVariantGetElementCount to obtain the number of elements in the vector or array.

The following example uses this function to loop through the values in a PROPVARIANT structure.

Examples


// PROPVARIANT propvar;
// assume propvar is initialized and valid

if ((propvar.vt & VT_TYPEMASK) == VT_R8)
{
    UINT cElem = PropVariantGetElementCount(propvar);
    HRESULT hr = <mark type="const">S_OK</mark>;
    
    for (UINT iElem = 0; SUCCEEDED(hr) && iElem < cElem; iElem ++)
    {
        DOUBLE nValue;
        hr = PropVariantGetDoubleElem(propvar, iElem, &nValue);
    
        if (SUCCEEDED(hr))
        {
            // nValue is valid now
        }
    }
}

Requirements

Minimum supported client

Windows XP with SP2, Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 with SP1 [desktop apps only]

Redistributable

Windows Desktop Search (WDS) 3.0

Header

Propvarutil.h

Library

Propsys.lib

DLL

Propsys.dll (version 6.0 or later)

See also

PropVariantGetElem

 

 

Community Additions

ADD
Show:
© 2015 Microsoft