UrlGetPartA function (shlwapi.h)
Accepts a URL string and returns a specified part of that URL.
LWSTDAPI UrlGetPartA(
[in] PCSTR pszIn,
[out] PSTR pszOut,
[in, out] DWORD *pcchOut,
DWORD dwPart,
DWORD dwFlags
);
[in] pszIn
Type: PCTSTR
A null-terminated string of maximum length INTERNET_MAX_URL_LENGTH that contains the URL.
[out] pszOut
Type: PTSTR
A pointer to a buffer that, when this function returns successfully, receives a null-terminated string with the specified part of the URL.
[in, out] pcchOut
Type: DWORD*
A pointer to a value that, on entry, is set to the number of characters in the pszOut buffer. When this function returns successfully, the value depends on whether the function is successful or returns E_POINTER. For other return values, the value of this parameter is meaningless.
dwPart
Type: DWORD
The flags that specify which part of the URL to retrieve. It can have one of the following values.
The host name.
The password.
The port number.
The query portion of the URL.
The URL scheme.
The username.
dwFlags
Type: DWORD
A flag that can be set to keep the URL scheme, in addition to the part that is specified by dwPart.
Keep the URL scheme.
Type: HRESULT
Returns S_OK if successful. The value pointed to by pcchOut will be set to the number of characters written to the output buffer, excluding the terminating NULL. If the buffer was too small, E_POINTER is returned, and the value pointed to by pcchOut will be set to the minimum number of characters that the buffer must be able to contain, including the terminating NULL character. Otherwise, a COM error value is returned.
Note
The shlwapi.h header defines UrlGetPart as an alias that 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 is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
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) |