Microsoft Windows CE 3.0  

CompareString

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function compares two character strings, using the locale specified by the identifier as the basis for the comparison.

int CompareString(
LCID
Locale, 
DWORD
dwCmpFlags, 
LPCTSTR
lpString1, 
int
cchCount1, 
LPCTSTR
lpString2, 
int
cchCount2
);

Parameters

Locale
Specifies the locale used for the comparison. This parameter can be one of the following predefined locale identifiers:
Value Description
LOCALE_SYSTEM_DEFAULT The system's default locale
LOCALE_USER_DEFAULT The current user's default locale

This parameter can also be a locale identifier created by the MAKELCIDmacro.

dwCmpFlags
Indicate how this function compares the two strings. The SORT_STRINGSORT flag is assumed and cannot be disabled. The NORM_IGNORECASE flag can be added as an option to ignore differences between uppercase and lowercase characters in the two strings.
lpString1
Pointer to the first string to be compared.
cchCount1
Specifies the number of characters in the string pointed to by the lpString1parameter. If this parameter is –1, the string is assumed to be null terminated, and the length is calculated automatically.
lpString2
Pointer to the second string to be compared.
cchCount2
Specifies the number of characters in the string pointed to by the lpString2parameter. If this parameter is –1, the string is assumed to be null terminated, and the length is calculated automatically.

Return Values

One of the following values indicates success:

1
The string pointed to by the lpString1parameter is less in lexical value than the string pointed to by the lpString2parameter.
2
The string pointed to by lpString1is equal in lexical value to the string pointed to by lpString2.
3
The string pointed to by lpString1is greater in lexical value than the string pointed to by lpString2.

Zero indicates failure, and GetLastErrormay return one of the following error values: