CUrl::CreateUrl
This method constructs a URL string from a CUrl object's component fields.
Syntax
inline BOOL CreateUrl(
LPTSTR lpszUrl,
DWORD* pdwMaxLength,
DWORD dwFlags = 0
) const throw( );
Parameters
lpszUrl
A string buffer to hold the complete URL string.pdwMaxLength
The maximum length of the lpszUrl string buffer.dwFlags
Specify ATL_URL_ESCAPE to convert all escape characters in lpszUrl to their real values.
Return Value
Returns TRUE on success, FALSE on failure.
Remarks
This method appends its individual fields in order to construct the complete URL string using the following format:
<scheme>://<user>:<pass>@<domain>:<port><path><extra>
When calling this method, the pdwMaxLength parameter should initially contain the maximum length of the string buffer referenced by the lpszUrl parameter. The value of the pdwMaxLength parameter will be updated with the actual length of the URL string.
Example
This sample demonstrates creation of a CUrl object and retrieving its URL string
CUrl url;
// Set the CUrl contents
url.CrackUrl(_T("https://someone:secret@www.microsoft.com:8080/visualc/stuff.htm#contents"));
// Obtain the length of the URL string and allocate a buffer to
// hold its contents
DWORD dwUrlLen = url.GetUrlLength() + 1;
TCHAR* szUrl = new TCHAR[dwUrlLen];
// Retrieve the contents of the CUrl object
url.CreateUrl(szUrl, &dwUrlLen, 0L);
// Cleanup
delete[] szUrl;
Requirements
Header: atlutil.h