WindowsCompareStringOrdinal function (winstring.h)

Compares two specified HSTRING objects and returns an integer that indicates their relative position in a sort order.

Syntax

HRESULT WindowsCompareStringOrdinal(
  HSTRING string1,
  HSTRING string2,
  INT32   *result
);

Parameters

string1

Type: [in] HSTRING

The first string to compare.

string2

Type: [in] HSTRING

The second string to compare.

result

Type: [out] INT32*

A value that indicates the lexical relationship between string1 and string2.

Return value

Type: HRESULT

This function can return one of these values.

Return code Description
S_OK
The comparison was successful.
E_INVALIDARG
result is NULL.

Remarks

Use the WindowsCompareStringOrdinal function to compare two HSTRING objects. After the comparison completes, the result out parameter contains one of three values.

Value Condition
-1 string1 is less than string2.
0 string1 equals string2.
1 string1 is greater than string2.

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header winstring.h
Library WinRTType.lib