CWebView::GetDownloadPath Method  
 
INT GetDownloadPath(
  DWORD dwFileId,  
  LPTSTR lpszFilePath,  
  INT nMaxLength  
);

The GetDownloadPath method returns the complete path of the local file for the specified download.

Parameters

dwFileId
An unsigned integer value which uniquely identifies the download. This value cannot be zero.
lpszFilePath
A null-terminated string buffer which will contain the full path to the local file. If this parameter is NULL, the file path is not copied but the method will return the length of the file path, not including the terminating null character. It is recommended that this buffer be large enough to store MAX_PATH (260) characters.
nMaxLength
An integer value which specifies the maximum number of characters which may be copied into the string buffer, including the terminating null. If the lpszFilePath parameter is NULL, this value should be zero.

Return Value

If the method succeeds, the return value is the length of the local file name, not including the terminating null character. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

This method returns the complete path to the file that will be created or overwritten during the download. The file path returned by this method is always an absolute path which ensures that the application does not need to resolve relative paths or expand environment variables. The path returned may refer to a file that has not yet been created or fully written if the download is still in progress. Applications should check the download status with GetDownloadInfo before assuming the file is complete and ready to use.

The dwFileId parameter uniquely identifies the download within the current client session. This identifier can be obtained from download-related event notifications or by calling WebViewEnumDownloads. As with other functions that use file identifiers, applications should treat this value as opaque and only valid for the lifetime of the session.

If the provided string buffer is too small, the method will return the required length of the file path, not including the terminating null character. The caller can use this information to allocate a sufficiently large buffer and call the method again. There are both ANSI and Unicode versions of this method and the correct version is called based on how the project is configured. If the GetDownloadPathA method is called, the file path will always be returned as a UTF-8 encoded string regardless of the current locale.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtmv12.lib
Unicode: Implemented as Unicode and ANSI versions

See Also