Export (0) Print
Expand All
Expand Minimize

InitPropVariantFromBoolean function

Initializes a given PROPVARIANT structure as a VT_BOOL using a specified Boolean value.

Syntax


HRESULT InitPropVariantFromBoolean(
  _In_   BOOL fVal,
  _Out_  PROPVARIANT *ppropvar
);

Parameters

fVal [in]

Type: BOOL

Source BOOL value.

ppropvar [out]

Type: PROPVARIANT*

When this function returns, contains the initialized PROPVARIANT structure.

Return value

Type: HRESULT

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

Remarks

This is an inline function, with its source code provided in the header. It is not included in any .dll or .lib file.

Note that the boolVal member specifically initialized by this function is of type VARIANT_BOOL and therefore can have values VARIANT_TRUE or VARIANT_FALSE. When working with this structure member directly, use these constants instead of TRUE or FALSE because VARIANT_TRUE is not equal to TRUE and sizeof(VARIANT_TRUE) is not the same as sizeof(TRUE).

Examples

The following example, to be included as part of a larger program, demonstrates how to use InitPropVariantFromBoolean.


PROPVARIANT propvar;

HRESULT hr = InitPropVariantFromBoolean(TRUE, &propvar);

if (SUCCEEDED(hr))
{
    // propvar now is valid and has type VT_BOOL.
 
    PropVariantClear(&propvar);
}

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

See also

PropVariantToBoolean
InitPropVariantFromBooleanVector
InitVariantFromBoolean

 

 

Community Additions

ADD
Show:
© 2014 Microsoft