Export (0) Print
Expand All
Expand Minimize

PropVariantToFileTimeVector function

Extracts data from a PROPVARIANT structure into a FILETIME vector.

Syntax


HRESULT PropVariantToFileTimeVector(
  _In_   REFPROPVARIANT propvar,
  _Out_  FILETIME *prgft,
  _In_   ULONG crgft,
  _Out_  ULONG *pcElem
);

Parameters

propvar [in]

Type: REFPROPVARIANT

Reference to a source PROPVARIANT structure.

prgft [out]

Type: FILETIME*

Points to a buffer containing crgft FILETIME values. When this function returns, the buffer has been initialized with pcElem FILETIME elements extracted from the source PROPVARIANT structure.

crgft [in]

Type: ULONG

Size in elements of the buffer pointed to by prgft.

pcElem [out]

Type: ULONG*

When this function returns, contains the count of FILETIME elements extracted from the source PROPVARIANT structure.

Return value

Type: HRESULT

Returns one of the following values.

Return codeDescription
S_OK

Returns S_OK if successful, or an error value otherwise.

TYPE_E_BUFFERTOOSMALL

The source PROPVARIANT contained more than crgn values. The buffer pointed to by prgft.

E_INVALIDARG

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 filetime vector value with a fixed number of elements.

If the source PROPVARIANT has type VT_VECTOR | VT_FILETIME, this helper function extracts up to crgft FILETIME values and places them into the buffer pointed to by prgft. If the PROPVARIANT contains more elements than will fit into the prgft buffer, this function returns an error and sets pcElem to 0.

The output FILETIMEs will use the same time zone as the source FILETIMEs.

Examples

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


// PROPVARIANT propvar;
// Assume the variable propvar is initialized and valid
FILETIME rgTimes[4]; // The application is expecting propvar to hold 4 FILETIMEs in a vector
ULONG cTimes;
HRESULT hr = PropVariantToFileTimeVector(propvar, rgTime, ARRAYSIZE(rgTime), &cTimes);
if (SUCCEEDED(hr))
{
     if (cTimes == ARRAYSIZE(rgTime))
     {
         // The application got 4 FILETIMEs which are now stored in rgTime
     }
     else
     {
         // The application got cTimes which are stored in the first cTimes elements of rgTime
     }
}

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

InitPropVariantFromFileTimeVector
PropVariantToFileTime
PropVariantToFileTimeVectorAlloc

 

 

Community Additions

ADD
Show:
© 2015 Microsoft