Downloads bits from the Internet and saves them to a file. The client can optionally be notified of progress by means of a notification callback.
HRESULT URLDownloadToFile(
LPUNKNOWN pCaller, // Caller's controlling IUnknown
LPCWSTR szURL, // Pointer to URL to be downloaded
LPCTSTR szFileName, // Pointer to file name
DWORD dwResv, // Reserved for future use
LPBINDSTATUSCALLBACK lpfnCB
// Caller's IBindStatusCallback
);
This function returns the same values as IBindHost::MonikerBindToStorage.
URLDownloadToFile calls the caller's IBindStatusCallback interface to provide notifications during the binding process. In particular, URLDownloadToFile calls IBindStatusCallback::OnProgress to report the ongoing status of the download. The caller does not need not implement any of the notification callbacks for the function to succeed, but doing so allows the client to receive notifications, if interested, and also allows downloads to be canceled by returning E_ABORT from the OnProgress call.
If pCaller is non-NULL, the caller is a COM object that is contained in another component, such as an ActiveX Control in the context of an HTML page. In this case, the function attempts the download in the context of the ActiveX client framework and allows the caller's container to receive callbacks on the progress of the download.
Windows NT: Use version 5.0 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in urlmon.h.
IBindStatusCallback, IBindStatusCallback::OnProgress