Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Extracts the FILETIME structure from a PROPVARIANT structure.
Syntax
PSSTDAPI PropVariantToFileTime(
[in] REFPROPVARIANT propvar,
[in] PSTIME_FLAGS pstfOut,
[out] FILETIME *pftOut
);
Parameters
[in] propvar
Type: REFPROPVARIANT
Reference to a source PROPVARIANT structure.
[in] pstfOut
Type: PSTIME_FLAGS
Specifies one of the following time flags.
PSTF_UTC (0)
Indicates the output will use coordinated universal time.
PSTF_LOCAL (1)
Indicates the output will use local time.
[out] pftOut
Type: FILETIME*
When this function returns, contains the extracted FILETIME structure.
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 a single filetime value. For instance, an application obtaining values from a property store can use this to safely extract a filetime value for filetime properties.
If the source PROPVARIANT has type VT_FILETIME or VT_DATE, this helper function extracts the value as a FILETIME using the timezone specified by pstfOut. If the source PROPVARIANT is VT_EMPTY or any other type, this function returns a failure result.
The source PROPVARIANT must be in Coordinated Universal Time (UTC). The PSTF_UTC and PSTF_LOCAL flags allow the calling application to specify what time zone the output should be converted to.
Examples
The following example, to be included as part of a larger program, demonstrates how to use PropVariantToFileTime to access a FILETIME value in a PROPVARIANT.
// IPropertyStore *ppropstore;
// Assume variable ppropstore is initialized and valid
PROPVARIANT propvar = {0};
HRESULT hr = ppropstore->GetValue(PKEY_DateModified, &propvar);
if (SUCCEEDED(hr))
{
// PKEY_DateModified is expected to produce a VT_FILETIME or VT_EMPTY value.
// PropVariantToFileTime will return a failure code for VT_EMPTY
FILETIME ftModified;
hr = PropVariantToFileTime(propvar, PSTF_UTC, &ftModified);
if (SUCCEEDED(hr))
{
// ftModified is now valid and contains a file time in UTC
}
else
{
// Unable to convert propvar to a FILETIME
}
PropVariantClear(&propvar);
}
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 |