共用方式為


interface ICoreWebView2DownloadStartingEventArgs

interface ICoreWebView2DownloadStartingEventArgs
  : public IUnknown

Event args for the DownloadStarting event.

Summary

Members Descriptions
get_Cancel The host may set this flag to cancel the download.
get_DownloadOperation Returns the ICoreWebView2DownloadOperation for the download that has started.
get_Handled The host may set this flag to TRUE to hide the default download dialog for this download.
get_ResultFilePath The path to the file.
GetDeferral Returns an ICoreWebView2Deferral object.
put_Cancel Sets the Cancel property.
put_Handled Sets the Handled property.
put_ResultFilePath Sets the ResultFilePath property.

Applies to

Product Introduced
WebView2 Win32 1.0.902.49
WebView2 Win32 Prerelease 1.0.902

Members

get_Cancel

The host may set this flag to cancel the download.

public HRESULT get_Cancel(BOOL * cancel)

If canceled, the download save dialog is not displayed regardless of the Handled property.

get_DownloadOperation

Returns the ICoreWebView2DownloadOperation for the download that has started.

public HRESULT get_DownloadOperation(ICoreWebView2DownloadOperation ** downloadOperation)

get_Handled

The host may set this flag to TRUE to hide the default download dialog for this download.

public HRESULT get_Handled(BOOL * handled)

The download will progress as normal if it is not canceled, there will just be no default UI shown. By default the value is FALSE and the default download dialog is shown.

get_ResultFilePath

The path to the file.

public HRESULT get_ResultFilePath(LPWSTR * resultFilePath)

If setting the path, the host should ensure that it is an absolute path, including the file name, and that the path does not point to an existing file. If the path points to an existing file, the file will be overwritten. If the directory does not exist, it is created.

The caller must free the returned string with CoTaskMemFree. See API Conventions.

GetDeferral

Returns an ICoreWebView2Deferral object.

public HRESULT GetDeferral(ICoreWebView2Deferral ** deferral)

Use this operation to complete the event at a later time.

put_Cancel

Sets the Cancel property.

public HRESULT put_Cancel(BOOL cancel)

put_Handled

Sets the Handled property.

public HRESULT put_Handled(BOOL handled)

put_ResultFilePath

Sets the ResultFilePath property.

public HRESULT put_ResultFilePath(LPCWSTR resultFilePath)