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.