PropVariantGetInt64Elem function (propvarutil.h)
Extracts a single Int64 element from a PROPVARIANT structure of type VT_I8, VT_VECTOR | VT_I8, or VT_ARRAY | VT_I8.
Syntax
PSSTDAPI PropVariantGetInt64Elem(
[in] REFPROPVARIANT propvar,
[in] ULONG iElem,
[out] LONGLONG *pnVal
);
Parameters
[in] propvar
Type: REFPROPVARIANT
Reference to the source PROPVARIANT structure.
[in] iElem
Type: ULONG
The vector or array index; otherwise, iElem must be 0.
[out] pnVal
Type: LONGLONG*
When this function returns, contains the extracted Int64 value.
Return value
Type: HRESULT
If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Remarks
This helper function works forPROPVARIANT structures of the following types:
- VT_I8
- VT_VECTOR | VT_I8
- VT_ARRAY | VT_I8
Examples
The following example, to be included as part of a larger program, demonstrates how to use PropVariantGetInt64Elem with an iteration statement to access the values in a PROPVARIANT.
// PROPVARIANT propvar;
// Assume propvar is initialized and valid;
if ((propvar.vt & VT_TYPEMASK) == VT_I8)
{
UINT cElem = PropVariantGetElementCount(propvar);
HRESULT hr = <mark type="const">S_OK</mark>;
for (UINT iElem = 0; SUCCEEDED(hr) && iElem < cElem; iElem ++)
{
LONGLONG nValue;
hr = PropVariantGetInt64Elem(propvar, iElem, &nValue);
if (SUCCEEDED(hr))
{
// nValue is valid now
}
}
}
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 |