VariantToDoubleArray function (propvarutil.h)
Extracts an array of DOUBLE values from a VARIANT structure.
Syntax
PSSTDAPI VariantToDoubleArray(
[in] REFVARIANT var,
[out] DOUBLE *prgn,
[in] ULONG crgn,
[out] ULONG *pcElem
);
Parameters
[in] var
Type: REFVARIANT
Reference to a source VARIANT structure.
[out] prgn
Type: DOUBLE*
Pointer to a buffer that contains crgn DOUBLE values. When this function returns, the buffer has been initialized with *pcElem DOUBLE elements extracted from the source VARIANT structure.
[in] crgn
Type: ULONG
The number of elements in the buffer pointed to by prgn.
[out] pcElem
Type: ULONG*
When this function returns, contains the count of DOUBLE elements extracted from the source VARIANT structure.
Return value
Type: HRESULT
Returns S_OK if successful, or an error value otherwise, including the following:
Return code | Description |
---|---|
|
The source VARIANT contained more than crgn values. |
|
The VARIANT was not of the appropriate type. |
Remarks
This helper function is used when the calling application expects a VARIANT to hold an array that consists of a fixed number of DOUBLE values.
If the source VARIANT has type VT_ARRAY | VT_DOUBLE, this function extracts up to crgn DOUBLE values and places them into the buffer pointed to by prgn.
If the VARIANT contains more elements than will fit into the prgn buffer, this function returns an error and sets *pcElem to 0.
Examples
The following example, to be included as part of a larger program, demonstrates how to use VariantToDoubleArray to access a DOUBLE array stored in a VARIANT.
// VARIANT var;
// Assume variable var is initialized and valid.
DOUBLE rgDoubles[4]; // The application expects var to hold 4 DOUBLEs in an array.
ULONG cDoubles;
HRESULT hr = VariantToDoubleArray(var, rgDoubles, ARRAYSIZE(rgDoubles), &cFlags);
if (SUCCEEDED(hr))
{
if (cFlags == ARRAYSIZE(rgDoubles))
{
// The application got 4 DOUBLEs which are now stored in rgDoubles.
}
else
{
// The application got *pcElem DOUBLEs which are stored in the first
// *pcElem elements of rgDoubles.
}
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP with SP2, Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2003 with SP1 [desktop apps only] |
Target Platform | Windows |
Header | propvarutil.h |
Library | Propsys.lib |
DLL | Propsys.dll (version 6.0 or later) |
Redistributable | Windows Desktop Search (WDS) 3.0 |