Skip to content

Latest commit

 

History

History
168 lines (121 loc) · 5.08 KB

nf-propvarutil-varianttobooleanarray.md

File metadata and controls

168 lines (121 loc) · 5.08 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:propvarutil.VariantToBooleanArray
VariantToBooleanArray function (propvarutil.h)
Extracts an array of Boolean values from a VARIANT structure.
VariantToBooleanArray
VariantToBooleanArray function [Windows Properties]
_shell_VariantToBooleanArray
properties.VariantToBooleanArray
propvarutil/VariantToBooleanArray
shell.VariantToBooleanArray
properties\VariantToBooleanArray.htm
properties
80a1e7d4-ec11-4b16-ba05-b97f3bbf02d0
12/05/2018
VariantToBooleanArray, VariantToBooleanArray function [Windows Properties], _shell_VariantToBooleanArray, properties.VariantToBooleanArray, propvarutil/VariantToBooleanArray, shell.VariantToBooleanArray
propvarutil.h
Windows
Windows XP with SP2, Windows Vista [desktop apps only]
Windows Server 2003 with SP1 [desktop apps only]
Propsys.lib
Propsys.dll (version 6.0 or later)
Windows
Windows Desktop Search (WDS) 3.0
19H1
VariantToBooleanArray
propvarutil/VariantToBooleanArray
c++
APIRef
kbSyntax
DllExport
Propsys.dll
VariantToBooleanArray

VariantToBooleanArray function

-description

Extracts an array of Boolean values from a VARIANT structure.

-parameters

-param var [in]

Type: REFVARIANT

Reference to a source VARIANT structure.

-param prgf [out]

Type: BOOL*

Pointer to a buffer that contains crgn Boolean values. When this function returns, the buffer has been initialized with *pcElem BOOL elements extracted from the source VARIANT structure.

-param crgn [in]

Type: ULONG

The number of elements in the buffer pointed to by prgf.

-param pcElem [out]

Type: ULONG*

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

-returns

Type: HRESULT

Returns S_OK if successful, or an error value otherwise, including the following:

Return code Description
TYPE_E_BUFFERTOOSMALL
The source VARIANT contained more than crgn values.
E_INVALIDARG
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 Boolean values.

If the source VARIANT is of type VT_ARRAY | VT_BOOL, this function extracts up to crgn BOOL values and places them into the buffer pointed to by prgf. If the VARIANT contains more elements than will fit into the prgf 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 VariantToBooleanArray to access an array of BOOL values stored in a VARIANT structure.

// VARIANT var;
// Assume variable var is initialized and valid
BOOL rgFlags[4]; // The application is expecting var to hold 4 BOOLs in an array.
ULONG cFlags;

HRESULT hr = VariantToBooleanArray(var, rgFlags, ARRAYSIZE(rgFlags), &cFlags);

if (SUCCEEDED(hr))
{
    if (cFlags == ARRAYSIZE(rgFlags))
    {
        // The application got 4 flag values which are now stored in rgFlags.
    }
    else
    {
        // The application got cFlags which are stored in the first cFlags 
        // elements of rgFlags.
    }
}

-see-also

InitVariantFromBooleanArray

PropVariantToBooleanVector

VariantGetBooleanElem

VariantToBoolean

VariantToBooleanArrayAlloc