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.
A version of this page is also available for
4/8/2010

This function combines a base and relative URL into a single URL. The resultant URL is canonicalized.

Syntax

BOOL WINAPI InternetCombineUrl(
  LPCTSTR 
lpszBaseUrl, 
  LPCTSTR 
lpszRelativeUrl, 
  LPTSTR 
lpszBuffer, 
  LPDWORD 
lpdwBufferLength, 
  DWORD 
dwFlags
);

Parameters

lpszBaseUrl

[in] Long pointer to the null-terminated string that contains the base URL to be combined.

lpszRelativeUrl

[in] Long pointer to the null-terminated string that contains the relative URL to be combined.

lpszBuffer

[out] Long pointer to a buffer that receives the null-terminated string that contains the resulting URL.

lpdwBufferLength

[in, out] Long pointer to the size, in bytes, of the lpszBufferbuffer. If the function succeeds, this parameter receives the length, in characters, of the resultant combined URL — the length does not include the terminating null character. If the function fails, this parameter receives the length, in bytes, of the required buffer — the length includes the terminating null character.

dwFlags

[in] Specifies the operation of the function. The following table shows the possible values. This parameter is one of these values.

Value Description

ICU_DECODE

Converts all %XX sequences to characters, including escape sequences, before the URL is parsed.

ICU_ENCODE_SPACES_ONLY

Encodes spaces only.

ICU_NO_ENCODE

Does not convert unsafe characters to escape sequences.

ICU_NO_META

Does not remove meta sequences (such as "." and "..") from the URL.

Return Value

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. The following table lists the possible error values for GetLastErrorand their descriptions.

Value Description

ERROR_BAD_PATHNAME

The URLs could not be combined.

ERROR_INSUFFICIENT_BUFFER

The buffer supplied to the function was insufficient or NULL. The DWORD indicated by the lpdwBufferLengthparameter will contain the number of bytes required to hold the resultant, combined URL.

ERROR_INTERNET_INVALID_URL

The format of the URL is invalid.

ERROR_INVALID_PARAMETER

Bad string, buffer, buffer size, or flags parameter.

Remarks

The lpdwBufferLengthparameter refers to the count of characters.

Requirements

Header wininet.h
Library wininet.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

WinInet Functions

Other Resources

InternetCanonicalizeUrl