Cracks a URL into its component parts.
Syntax
BOOL InternetCrackUrl( IN LPCTSTR lpszUrl, IN DWORD dwUrlLength, IN DWORD dwFlags, IN OUT LPURL_COMPONENTS lpUrlComponents );The actual syntax of this function varies between its ANSI and Unicode implementations. For more information, see Win32 Internet Functions Syntax.
Parameters
- lpszUrl
- Address of a string that contains the canonical URL to crack.
- dwUrlLength
- Unsigned long integer value that contains the length of the lpszUrl string in TCHAR, or zero if lpszUrl is an ASCIIZ string.
- dwFlags
- Unsigned long integer value that contains the flags controlling the operation. This can be one of the following values:
- ICU_DECODE
- Converts encoded characters back to their normal form. This can be used only if the user provides buffers in the URL_COMPONENTS structure to copy the components into.
- ICU_ESCAPE
- Converts all escape sequences (%xx) to their corresponding characters. This can be used only if the user provides buffers in the URL_COMPONENTS structure to copy the components into.
- lpUrlComponents
- Address of a URL_COMPONENTS structure that receives the URL components.
Return Value
Returns TRUE if the function succeeds, or FALSE otherwise. To get extended error information, call GetLastError.
Remarks
The required components are indicated by members of the URL_COMPONENTS structure. Each component has a pointer to the value and has a member that stores the length of the stored value. If both the value and the length for a component are equal to zero, that component is not returned. If the pointer to the value of the component is NULL and the value of its corresponding length member is nonzero, the address of the first character of the corresponding component in the lpszUrl string is stored in the pointer, and the length of the component is stored in the length member.
If the pointer contains the address of the user-supplied buffer, the length member must contain the size of the buffer. InternetCrackUrl copies the component into the buffer, and the length member is set to the length of the copied component, minus 1 for the trailing string terminator.
For InternetCrackUrl to work properly, the size of the URL_COMPONENTS structure must be stored in the dwStructSize member.
Function Information
Windows NT Use version 4.0. Implemented as ANSI and Unicode functions. Windows Use Windows 95 and later. Implemented as ANSI and Unicode functions. Header Wininet.h Import library Wininet.lib Minimum availability Internet Explorer 3.0 (ANSI only), 5 (ANSI and Unicode)
Windows CE
Windows CE Use version 2.12 and later. Implemented as ANSI and Unicode functions. Minimum availability Internet Explorer 4.0
See Also
Microsoft Win32 Internet Functions Overview, Handling Uniform Resource Locators, Microsoft Win32 Internet Functions Reference, Uniform Resource Locator (URL) Functions, FtpOpenFile, InternetCloseHandle, InternetFindNextFile, InternetSetStatusCallback