UrlCompareW function (shlwapi.h)

Makes a case-sensitive comparison of two URL strings.

Syntax

int UrlCompareW(
  [in] PCWSTR psz1,
  [in] PCWSTR psz2,
       BOOL   fIgnoreSlash
);

Parameters

[in] psz1

Type: PCTSTR

A null-terminated string of maximum length INTERNET_MAX_URL_LENGTH that contains the first URL.

[in] psz2

Type: PCTSTR

A null-terminated string of maximum length INTERNET_MAX_URL_LENGTH that contains the second URL.

fIgnoreSlash

Type: BOOL

A value that is set to TRUE to have UrlCompare ignore a trailing '/' character on either or both URLs.

Return value

Type: int

Returns zero if the two strings are equal. The function will also return zero if fIgnoreSlash is set to TRUE and one of the strings has a trailing '' character. The function returns a negative integer if the string pointed to by psz1 is less than the string pointed to by psz2. Otherwise, it returns a positive integer.

Remarks

For best results, you should first canonicalize the URLs with UrlCanonicalize. Then, compare the canonicalized URLs with UrlCompare.

Note

The shlwapi.h header defines UrlCompare as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 5.0 or later)

See also

StrCmp