EN
Este contenido no se encuentra disponible en su idioma, pero aquí tiene la versión en inglés.

VariantToDoubleArrayAlloc function

Allocates an array of DOUBLE values then extracts data from a VARIANT structure into that array.

Syntax


HRESULT VariantToDoubleArrayAlloc(
  _In_   REFVARIANT var,
  _Out_  DOUBLE **pprgn,
  _Out_  ULONG *pcElem
);

Parameters

var [in]

Type: REFVARIANT

Reference to a source VARIANT structure.

pprgn [out]

Type: DOUBLE**

When this function returns, contains a pointer to an array of DOUBLE values extracted from the source VARIANT structure.

pcElem [out]

Type: ULONG*

When this function returns, contains a pointer to the count of elements extracted from the source VARIANT structure.

Return value

Type: HRESULT

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

Remarks

This helper function is used when the calling application expects a VARIANT to hold an array of DOUBLE values.

If the source VARIANT is of type VT_ARRAY | VT_R8, this function extracts an array of DOUBLE values into a newly allocated array. The calling application is responsible for using CoTaskMemFree to release the array pointed to by pprgn when it is no longer needed.

Examples

The following example, to be included as part of a larger program, demonstrates how to use VariantToDoubleArrayAlloc to access a DOUBLE array value in a VARIANT.


// VARIANT var;
// Assume variable var is initialized and valid.
// The application expects var to contain an array of DOUBLE values.
DOUBLE *prgDoubles;
ULONG cElems;

HRESULT hr = VariantToDoubleArrayAlloc(var, &prgDoubles, &cElems);

if (SUCCEEDED(hr))
{
     // prgDoubles now points to a vector of cElems DOUBLEs.
     CoTaskMemFree(prgDoubles);
}

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

InitVariantFromDoubleArray
VariantToDoubleArray
PropVariantToDoubleVectorAlloc
PropVariantChangeType

 

 

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft