Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
URL Monikers
Reference
Functions
 URLDownloadToCacheFile Function
URLDownloadToCacheFile Function

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

Syntax

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

Parameters

lpUnkcaller
[in] A pointer to the controlling IUnknown interface of the calling Microsoft 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 Component Object Model (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] A pointer to the caller IBindStatusCallback interface. URLDownloadToCacheFile calls this interface IBindStatusCallback::OnProgress method on a connection activity, including the arrival of data. The IBindStatusCallback::OnDataAvailable method is never called. By using IBindStatusCallback::OnProgress, the caller can implement a user interface or other progress monitoring functionality. The download operation can be canceled by returning E_ABORT from the IBindStatusCallback::OnProgress call. This can be set to NULL.

Return Value

Returns one of the following values.

E_FAILThe operation failed.
E_OUTOFMEMORYThe buffer length is invalid, or there is insufficient memory to complete the operation.
S_OKThe operation succeeded.

Remarks

The client can choose to be notified of progress through a notification callback.

This function always returns a file name, if the download operation succeeds. If the given URL is a "file:" URL, URLDownloadToCacheFile directly returns the file name for the "file:" URL, instead of making a copy to the cache. If the given URL is an Internet URL, such as "http:" or "ftp:," URLDownloadToCacheFile downloads this file and returns the local file name of the cached copy. Use this function to ensure that a file name is returned without unnecessary copying of data.

Function Information

Stock Implementationurlmon.dll
Custom ImplementationNo
HeaderUrlmon.h
Import libraryUrlmon.lib
Minimum availabilityInternet Explorer 3.0
Minimum operating systems Windows NT 4.0, Windows 95
UnicodeImplemented as ANSI and Unicode versions.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker