URLDownloadToCacheFile

From aldeid
Jump to navigation Jump to search

Description

Downloads data to the Internet cache and returns the file name of the cache location for retrieving the bits.

Syntax

HRESULT URLDownloadToCacheFile(
  _In_       LPUNKNOWN           lpUnkcaller,
  _In_       LPCSTR              szURL,
  _Out_      LPTSTR              szFileName,
  _In_       DWORD               cchFileName,
  _Reserved_ DWORD               dwReserved,
  _In_opt_   IBindStatusCallback *pBSC
);

Parameters

lpUnkcaller [in]
A pointer to the controlling IUnknown interface of the calling ActiveX component, if the caller is an ActiveX component. If the caller is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a COM object that is contained in another component, such as an ActiveX control in the context of an HTML page. This parameter represents the outermost IUnknown of the calling component. The function attempts the download in the context of the ActiveX client framework, and allows the caller container to receive callbacks on the progress of the download.
szURL [in]
A pointer to a string value that contains the URL to download. Cannot be set to NULL.
szFileName [out]
A pointer to a string value that contains the name of the downloaded file. Cannot be set to NULL.
cchFileName [in]
An unsigned long integer value that contains the number of characters of the szFileName value.
dwReserved
Reserved. Must be set to 0.
pBSC [in, optional]
A pointer to the IBindStatusCallback interface of the caller. By using IBindStatusCallback::OnProgress, a caller can receive download status. URLDownloadToCacheFile calls the IBindStatusCallback::OnProgress and IBindStatusCallback::OnDataAvailable methods as data is received. The download operation can be canceled by returning E_ABORT from any callback. This parameter can be set to NULL if status is not required.

Return value

Returns one of the following values.

Return code Description
E_FAIL The operation failed.
E_OUTOFMEMORY The buffer length is invalid, or there is insufficient memory to complete the operation.
S_OK The operation succeeded.