TriggerFileDownload function

Directs Windows Internet Explorer to download a file.

Syntax

HRESULT STDAPICALLTYPE TriggerFileDownload(
  _In_ LPCWSTR lpszURL
);

Parameters

  • lpszURL [in]
    A pointer to the URL of the file to download.

Return value

This function can return one of these values.

Return code Description
E_FAIL

The function was called from an invalid process.

 

Remarks

The TriggerFileDownload function is designed to allow Browser Helper Objects (BHOs) to request Internet Explorer to download a file. Consequrently, the function is allowed only from the process that hosts BHOs.

When you call TriggerFileDownload, the user is prompted to download the file passed as the lpszURL parameter. If the user cancels the confirmation dialog box, the file is not downloaded.

For security reasons, the confirmation dialog box is displayed for all file downloads requested using TriggerFileDownload, even if the user has previously specified files of similar types to always open.

Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2008

Header

N/A

DLL

Msframe.dll