PropVariantToInt64Vector function (propvarutil.h)
Extracts data from a PROPVARIANT structure into an Int64 vector.
Syntax
PSSTDAPI PropVariantToInt64Vector(
[in] REFPROPVARIANT propvar,
[out] LONGLONG *prgn,
[in] ULONG crgn,
[out] ULONG *pcElem
);
Parameters
[in] propvar
Type: REFPROPVARIANT
Reference to a source PROPVARIANT structure.
[out] prgn
Type: LONGLONG*
Points to a buffer containing crgn LONGLONG values. When this function returns, the buffer has been initialized with pcElem LONGLONG elements extracted from the source PROPVARIANT.
[in] crgn
Type: ULONG
Size of the buffer pointed to by prgn in elements.
[out] pcElem
Type: ULONG*
When this function returns, contains the count of LONGLONG values extracted from the source PROPVARIANT structure.
Return value
Type: HRESULT
This function can return one of these values.
Return code | Description |
---|---|
|
Returns S_OK if successful, or an error value otherwise. |
|
The source PROPVARIANT contained more than crgn values. The buffer pointed to by prgn. |
|
The PROPVARIANT was not of the appropriate type |
Remarks
This helper function is used in places where the calling application expects a PROPVARIANT to hold a vector of LONGLONG values with a fixed number of elements.
If the source PROPVARIANT has type VT_VECTOR | VT_I8 or VT_ARRAY | VT_I8, this helper function extracts up to crgn LONGLONG values and places them into the buffer pointed to by prgn. If the PROPVARIANT contains more elements than will fit into the prgn buffer, this function returns an error and sets pcElem to 0.
Examples
The following example, to be included as part of a larger program, demonstrates how to use PropVariantToInt64Vector to access an Int64 vector value in a PROPVARIANT.
// PROPVARIANT propvar;
// Assume the variable propvar is initialized and valid
LONGLONG rgLongs[4]; // The application is expecting propvar to hold 4 LONGLONGs in a vector
ULONG cElems;
HRESULT hr = PropVariantToInt64Vector(propvar, rgLongs, ARRAYSIZE(rgLongs), &cElems);
if (SUCCEEDED(hr))
{
if (cElems == ARRAYSIZE(rgLongs))
{
// The application got 4 LONGLONGs which are now stored in rgLongs
}
else
{
// The application got cElems which are stored in the first cElems elements of rgLongs
}
}
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 |