PropVariantToBooleanVector function (propvarutil.h)
Extracts a Boolean vector from a PROPVARIANT structure.
Syntax
PSSTDAPI PropVariantToBooleanVector(
[in] REFPROPVARIANT propvar,
[out] BOOL *prgf,
[in] ULONG crgf,
[out] ULONG *pcElem
);
Parameters
[in] propvar
Type: REFPROPVARIANT
Reference to a source PROPVARIANT structure.
[out] prgf
Type: BOOL*
Points to a buffer that contains crgf BOOL values. When this function returns, the buffer has been initialized with pcElem Boolean elements extracted from the source PROPVARIANT structure.
[in] crgf
Type: ULONG
Number of elements in the buffer pointed to by prgf.
[out] pcElem
Type: ULONG*
When this function returns, contains the count of Boolean elements extracted from source PROPVARIANT structure.
Return value
Type: HRESULT
This function can return one of these values.
Return code | Description |
---|---|
|
Returns S_OK if successful, or an error value otherwise. |
|
The source PROPVARIANT contained more than crgf values. The buffer pointed to by prgf. |
|
The PROPVARIANT was not of the appropriate type. |
Remarks
This helper function is used when the calling application expects a PROPVARIANT to hold a Boolean vector value with a fixed number of elements.
If the source PROPVARIANT has type VT_VECTOR | VT_BOOL or VT_ARRAY | VT_BOOL, this helper function extracts up to crgf Boolean values and places them into the buffer pointed to by prgf. If the PROPVARIANT 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 PropVariantToBooleanVector to access a Boolean vector stored in a PROPVARIANT.
// PROPVARIANT propvar;
// Assume the variable propvar is initialized and valid.
// The application is expecting the propvar variable to hold 4 Booleans
// in a vector.
BOOL rgFlags[4];
ULONG cFlags;
HRESULT hr = PropVariantToBooleanVector(propvar, rgFlags, ARRAYSIZE(rgFlags), &cFlags);
if (SUCCEEDED(hr))
{
if (cFlags == ARRAYSIZE(rgFlags))
{
// The application received 4 flags which are now stored in rgFlags.
}
else
{
// The application received cFlags flags which are now stored in the
// first cFlags elements of rgFlags.
}
}
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 |