NAME

VarCmp  (OLEAUT32.176)

SYNOPSIS

 HRESULT VarCmp
 (
  LPVARIANT left,
  LPVARIANT right,
  LCID      lcid,
  DWORD     flags
 )

DESCRIPTION

Compare two variants.

PARAMS

left [In] First variant.
right [In] Second variant.
lcid [In] LCID (locale identifier) for the comparison.
flags [In] Flags to be used in the comparison: NORM_IGNORECASE, NORM_IGNORENONSPACE, NORM_IGNORESYMBOLS, NORM_IGNOREWIDTH, NORM_IGNOREKANATYPE, NORM_IGNOREKASHIDA.

RETURNS

VARCMP_LT: left variant is less than right variant. VARCMP_EQ: input variants are equal. VARCMP_GT: left variant is greater than right variant. VARCMP_NULL: either one of the input variants is NULL.

Failure: An HRESULT error code indicating the error.

NOTES

Native VarCmp up to and including WinXP doesn't like I1, UI2, VT_UI4, UI8 and UINT as input variants. INT is accepted only as left variant.

If both input variants are ERROR then VARCMP_EQ will be returned, else an ERROR variant will trigger an error.

Both input variants can have VT_RESERVED flag set which is ignored unless one and only one of the variants is a BSTR and the other one is not an EMPTY variant. All four VT_RESERVED combinations have a different meaning:

- BSTR and other: BSTR is always greater than the other variant.

- BSTR|VT_RESERVED and other: a string comparison is performed.

- BSTR and other|VT_RESERVED: If the BSTR is a number a numeric comparison will take place else the BSTR is always greater.

- BSTR|VT_RESERVED and other|VT_RESERVED: It seems that the other variant is ignored and the return value depends only on the sign of the BSTR if it is a number else the BSTR is always greater. A positive BSTR is greater, a negative one is smaller than the other variant.

SEE

VarBstrCmp for the lcid and flags usage.

IMPLEMENTATION

Declared in "oleauto.h". https://source.winehq.org/source/include/oleauto.h

Implemented in "dlls/oleaut32/variant.c". https://source.winehq.org/source/dlls/oleaut32/variant.c

Debug channel "variant".


Copyright © 2024 The Wine Project. All trademarks are the property of their respective owners. Visit WineHQ for license details. Generated Mar 2024.