EN
このコンテンツは設定された言語で表示できません。英語版のページが表示されます。

PropVariantToInt64 function

Extracts a LONGLONG value from a PROPVARIANT structure. If no value can be extracted, then a default value is assigned.

Syntax


HRESULT PropVariantToInt64(
  _In_   REFPROPVARIANT propvarIn,
  _Out_  LONGLONG *pllRet
);

Parameters

propvarIn [in]

Type: REFPROPVARIANT

Reference to a source PROPVARIANT structure.

pllRet [out]

Type: LONGLONG*

When this function returns, contains the extracted property value if one exists; otherwise, 0.

Return value

Type: HRESULT

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

Remarks

This helper function is used in places where the calling application expects a PROPVARIANT to hold an LONGLONG value. 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 a conversion is not possible, PropVariantToInt64 will return a failure code and set pllRet to 0. See PropVariantChangeType for a list of possible conversions. Of note, VT_EMPTY is successfully converted to 0.

Examples


// PROPVARIANT propvar;
// Assume the variable propvar is initialized and valid
LONGLONG llValue; // The application is expecting propvar to hold a VT_I8 value
HRESULT hr = PropVariantToInt64(propvar, &llValue);
if (SUCCEEDED(hr))
{
     // llValue is valid
}                    
else
{
         // the extraction failed
}

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
PropVariantToInt64Vector
VariantToInt64
PropVariantChangeType

 

 

コミュニティの追加

追加
表示:
© 2015 Microsoft