EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

PropVariantToInt64WithDefault function

Extracts the Int64 property value of a PROPVARIANT structure. If no value exists, then specified default value is returned.

Syntax


LONGLONG PropVariantToInt64WithDefault(
  _In_  REFPROPVARIANT propvarIn,
  _In_  LONGLONG llDefault
);

Parameters

propvarIn [in]

Type: REFPROPVARIANT

Reference to a source PROPVARIANT structure.

llDefault [in]

Type: LONGLONG

Specifies a default property value, for use where no value currently exists.

Return value

Type: LONGLONG

Returns the extracted LONGLONG value, or default.

Remarks

This helper function is used in places where the calling application expects a PROPVARIANT to hold a LONGLONG value and would like to use a default value if it does not. For instance, an application obtaining values from a property store can use this to safely extract the LONGLONG value for Int64 properties.

If the source PROPVARIANT has type VT_I8, this helper function extracts the LONGLONG value. Otherwise, it attempts to convert the value in the PROPVARIANT structure into a LONGLONG. If the source PROPVARIANT has type VT_EMPTY or a conversion is not possible, then PropVariantToInt64WithDefault will return the default provided by llDefault. See PropVariantChangeType for a list of possible conversions.

Examples

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


// PROPVARIANT propvar;
// Assume the variable propvar is initialized and valid
// The application is expecting propvar to hold a VT_I8 value, but wishes to treat VT_EMPTY as -1.
LONGLONG llValue = PropVariantToInt64WithDefault(propvar, -1);
// llValue is valid

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

InitPropVariantFromInt64
PropVariantToInt64
VariantToInt64
PropVariantChangeType

 

 

Community-Beiträge

HINZUFÜGEN
Anzeigen:
© 2014 Microsoft