다음을 통해 공유


Creating and Cracking URLs (Windows Embedded CE 6.0)

1/6/2010

The InternetCreateUrl function uses the data in the URL_COMPONENTS structure to create a URL.

The data members that make up the URL_COMPONENTS structure are the scheme, host name, port number, user name, password, URL path, and additional data, such as search parameters. Each member, except the port number, has a string member that holds the data, and a member that holds the length of the string member.

For each required data member, the pointer member should contain the address of the buffer holding the data. The length member should be set to zero if the pointer member contains the address of a zero-terminated string; the length member should be set to the string length if the pointer member contains the address of a string that is not zero-terminated. The pointer member of any data member that are not required must be set to NULL.

The InternetCrackUrl function divides the received URL into separate values and passes these values to the data members declared in URL_COMPONENTS. The scheme and port numbers have only a member that stores the corresponding value; they are both returned on all successful calls to InternetCrackUrl.

To get the value of a data member declared in URL_COMPONENTS, the member that stores the string length of that member is set to a nonzero value. The string member can be either the address of a buffer or NULL.

If the pointer member contains the address of a buffer, the string length member must contain the size of that buffer. InternetCrackUrl returns the data as a string in the buffer and stores the string length in the string length member.

If the pointer member is set to NULL, the string length member can be set to any nonzero value. InternetCrackUrl stores the address of the first character of the URL string that contains the URL data and sets the string length to the number of characters in the remaining part of the URL string that pertains to the data member.

All pointer members set to NULL with a nonzero length member point to the appropriate starting point in the URL string. The length stored in the length member must be used to determine the end of the individual member's data.

To finish initializing URL_COMPONENTS properly, the dwStructSize member must be set to the size of the URL_COMPONENTS structure.

See Also

Concepts

HTTP Sessions