PropVariantToBooleanVectorAlloc function

Extracts data from a PROPVARIANT structure into a newly allocated Boolean vector.

Syntax


HRESULT PropVariantToBooleanVectorAlloc(
  _In_  REFPROPVARIANT propvar,
  _Out_ BOOL           **pprgf,
  _Out_ ULONG          *pcElem
);

Parameters

propvar [in]

Type: REFPROPVARIANT

Reference to a source PROPVARIANT structure.

pprgf [out]

Type: BOOL**

When this function returns, contains a pointer to a vector of Boolean values extracted from the source PROPVARIANT structure.

pcElem [out]

Type: ULONG*

When this function returns, contains the count of Boolean elements extracted from the source PROPVARIANT structure.

Return value

Type: HRESULT

This function can return one of these values.

Return codeDescription
S_OK

Returns S_OK if successful, or an error value otherwise.

E_INVALIDARG

ThePROPVARIANTwas not of the appropriate type.

 

Remarks

This helper function is used in places where the calling application expects a PROPVARIANT to hold a Boolean vector value.

If the source PROPVARIANT has type VT_VECTOR | VT_BOOL or VT_ARRAY | VT_BOOL, this function extracts a vector of Boolean values into a newly allocated vector of BOOL values. The calling application is responsible for using CoTaskMemFree to release the vector pointed to by pprgf when it is no longer needed.

Examples

The following example, to be included as part of a larger program, demonstrates how to use PropVariantToBooleanVectorAlloc to access a Boolean vector value in a PROPVARIANT.


// PROPVARIANT propvar;
// Assume the variable propvar is initialized and valid. The application is 
// expecting propvar to contain a vector of Boolean values.
BOOL *prgFlags;
ULONG cFlags;
HRESULT hr = PropVariantToBooleanVectorAlloc(propvar, &prgFlags, &cFlags);

if (SUCCEEDED(hr))
{
     // The prgFlags variable now points to a vector that contains a count
     // of cFlags flags.
     CoTaskMemFree(prgFlags);
}

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

InitPropVariantFromBooleanVector
IsPropVariantVector
PropVariantGetBooleanElem
PropVariantToBooleanVector

 

 

Show: