CWebView::CancelDownload Method  
 
BOOL CancelDownload(
  DWORD dwFileId  
);

The CancelDownload method cancels the specified download in progress.

Parameters

dwFileId
An integer which specifies a unique file identifier. This value cannot be zero.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The CancelDownload method causes the specified file download to be canceled. If the transfer has completed or has already been canceled, this method has no effect. This method does not wait for the download to be canceled before it returns; it returns immediately after asynchronously requesting the download be canceled. The WEBVIEW_EVENT_DOWNLOAD_COMPLETED event will fire once the download has stopped.

The dwFileId value is obtained when the WEBVIEW_EVENT_DOWNLOAD_STARTING event is fired and the lParam event argument will contain the unique file identifier for the download. You should treat the identifier as an opaque integer and not depend on the value being sequential. It is only guaranteed that the value will be unique for all downloads during the session and is only valid for the browser that initiated the download. Note there can be multiple downloads in progress simultaneously.

The GetDownloadInfo method can be used to get the status of the download and determine if it completed successfully, failed or was canceled.

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

See Also