VarCmp(3w)

VarCmp3w

Usage

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

Overview

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".

Implemented in "dlls/oleaut32/variant.c".

Debug channel "variant".

Releases

4 releases since Debian 4.0 (Etch); the text changed 3 times.

  1. 4.0
  2. 5.0
  3. 6.0
  4. 7

From libwine-dev 1.4.1-4 in Debian 7 (Wheezy). Parsed by carta from the page's man source.