Compartilhar via


InternetCrackUrl

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function breaks down a URL into its component parts.

Syntax

BOOL WINAPI InternetCrackUrl(
  LPCTSTR lpszUrl, 
  DWORD dwUrlLength, 
  DWORD dwFlags, 
  LPURL_COMPONENTS lpUrlComponents
);

Parameters

  • lpszUrl
    [in] Long pointer to a null-terminated string that contains the canonical URL to break down.
  • dwUrlLength
    [in] Specifies the length of the lpszUrl string, or zero if lpszUrl is an ASCIIZ string.
  • dwFlags
    [in] Specifies the operation. The following table shows the possible values. This parameter is one of these values.

    Value Description

    ICU_DECODE

    Converts encoded characters back to their default 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
    [in, out] Long pointer to a URL_COMPONENTS structure that receives the URL components.

Return Value

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError.

Remarks

Always directly call the ANSI version of this function, InternetCrackUrlA.

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.

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

FtpOpenFile
InternetCloseHandle
InternetFindNextFile
InternetSetStatusCallback
URL_COMPONENTS
WinInet Functions