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

The InternetCreateUrlfunction uses the data in the URL_COMPONENTSstructure to create a URL.

The data members that make up the URL_COMPONENTSstructure 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 InternetCrackUrlfunction 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. InternetCrackUrlreturns 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. InternetCrackUrlstores 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_COMPONENTSproperly, the dwStructSizemember must be set to the size of the URL_COMPONENTSstructure.

See Also

Concepts

HTTP Sessions