The CompareString function compares two character strings, using the locale specified by the given identifier as the basis for the comparison.
Declare Function CompareString Lib "kernel32" Alias "CompareStringA" (ByVal Locale As Long, ByVal dwCmpFlags As Long, ByVal lpString1 As String, ByVal cchCount1 As Long, ByVal lpString2 As String, ByVal cchCount2 As Long) As Long
|Operating Systems Supported|
|Requires Windows NT 3.1 or later; Requires Windows 95 or later|
|∑ Locale |
Specifies the locale used for the comparison. This parameter can be one of the following predefined locale identifiers:
The systemís default locale.
The current userís default locale.
This parameter can also be a locale identifier created by the MAKELCID macro.
A set of flags that indicate how the function compares the two strings. By default, these flags are not set. This parameter can specify zero to get the default behavior, or it can be any combination of the following values:
Do not differentiate between Hiragana and Katakana characters. Corresponding Hiragana and Katakana characters compare as equal.
Ignore nonspacing characters.
Do not differentiate between a single-byte character and the same character as a double-byte character.
Treat punctuation the same as symbols.
Points to the first string to be compared.
Specifies the size, in bytes (ANSI version) or characters (Unicode version), of the string pointed to by the lpString1 parameter. If this parameter is - 1, the string is assumed to be null terminated and the length is calculated automatically.
Points to the second string to be compared.
Specifies the size, in bytes (ANSI version) or characters (Unicode version), of the string pointed to by the lpString2 parameter. If this parameter is - 1, the string is assumed to be null terminated and the length is calculated automatically.
|If the function succeeds, the return value is one of the following values: |
The string pointed to by the lpString1 parameter is less in lexical value than the string pointed to by the lpString2 parameter.
The string pointed to by lpString1 is equal in lexical value to the string pointed to by lpString2.
The string pointed to by lpString1 is greater in lexical value than the string pointed to by lpString2.
If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes: ERROR_INVALID_FLAGS