PropVariantCompareEx function (propvarutil.h)

Extends PropVariantCompare by allowing the caller to compare two PROPVARIANT structures based on specified comparison units and flags.

Syntax

PSSTDAPI_(int) PropVariantCompareEx(
  [in] REFPROPVARIANT        propvar1,
  [in] REFPROPVARIANT        propvar2,
  [in] PROPVAR_COMPARE_UNIT  unit,
  [in] PROPVAR_COMPARE_FLAGS flags
);

Parameters

[in] propvar1

Type: REFPROPVARIANT

Reference to the first PROPVARIANT structure.

[in] propvar2

Type: REFPROPVARIANT

Reference to the second PROPVARIANT structure.

[in] unit

Type: PROPVAR_COMPARE_UNIT

Specifies, where appropriate, one of the comparison units defined in PROPVAR_COMPARE_UNIT.

[in] flags

Type: PROPVAR_COMPARE_FLAGS

Specifies one of the following:

PVCF_DEFAULT (0x00000000)

When comparing strings, use StrCmpLogical.

PVCF_TREATEMPTYASGREATERTHAN (0x00000001)

Regard empty or null values as greater than non-empty values. This value can be OR-ed with any other value.

PVCF_USESTRCMP (0x00000002)

When comparing strings, use StrCmp.

PVCF_USESTRCMPC (0x00000004)

When comparing strings, use StrCmpC.

PVCF_USESTRCMPI (0x00000008)

When comparing strings, use StrCmpI.

PVCF_USESTRCMPIC (0x00000010)

When comparing strings, use StrCmpIC.

Return value

Type: INT

  • Returns 1 if propvar1 is greater than propvar2
  • Returns 0 if propvar1 equals propvar2
  • Returns -1 if propvar1 is less than propvar2

Remarks

This function does not compare all types; only selected types are currently comparable.

By default, VT_NULL / VT_EMPTY / 0-element vectors are considered to be less than any other vartype.

If the vartypes are different, this function attempts to convert propvar2 to the vartype of propvar1 before comparing them.

Note  Behavior of this function, and therefore the results it returns, can change from release to release. It should not be used for canonical sorting applications.
 

Requirements

Requirement Value
Minimum supported client Windows XP with SP2, Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 with SP1 [desktop apps | UWP apps]
Target Platform Windows
Header propvarutil.h
Library Propsys.lib
DLL Propsys.dll (version 6.0 or later)
Redistributable Windows Desktop Search (WDS) 3.0