URLDownloadToFile Function
来源:互联网 发布:淘宝秒杀器有用吗 编辑:程序博客网 时间:2024/06/14 21:32
原文地址: http://msdn.microsoft.com/zh-cn/ms775123
Downloads bits from the Internet and saves them to a file.
Syntax
- HRESULT URLDownloadToFile(
- LPUNKNOWN pCaller,
- LPCTSTR szURL,
- LPCTSTR szFileName,
- DWORD dwReserved,
- LPBINDSTATUSCALLBACK lpfnCB
- );
Parameters
- pCaller
- A pointer to the controlling IUnknown interface of the calling Microsoft ActiveX component, if the caller is an ActiveX component. If the calling application 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
- A pointer to a string value that contains the URL to download. Cannot be set to NULL. If the URL is invalid, INET_E_DOWNLOAD_FAILURE is returned.
- szFileName
- A pointer to a string value containing the name or full path of the file to create for the download. If szFileName includes a path, the target directory must already exist.
- dwReserved
- Reserved. Must be set to 0.
- lpfnCB
- A pointer to the IBindStatusCallback interface of the caller. By using OnProgress, a caller can receive download status. URLDownloadToFile calls theOnProgress and 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.
S_OKThe download started successfully.E_OUTOFMEMORYThe buffer length is invalid, or there is insufficient memory to complete the operation.INET_E_DOWNLOAD_FAILUREThe specified resource or callback interface was invalid.
Remarks
URLDownloadToFile binds to a host that supports IBindHost to perform the download. To do this, it first queries the controlling IUnknown passed as pCallerfor IServiceProvider, then calls IServiceProvider::QueryService with SID_SBindHost. If pCaller does not support IServiceProvider, IOleObject or IObjectWithSite is used to query the object's host container. If no IBindHost interface is supported, or pCaller is NULL, URLDownloadToFile creates its own bind context to intercept download notifications.
URLDownloadToFile returns S_OK even if the file cannot be created and the download is canceled. If the szFileName parameter contains a file path, ensure that the destination directory exists before calling URLDownloadToFile. For best control over the download and its progress, an IBindStatusCallbackinterface is recommended.
Windows Internet Explorer 8. URLDownloadToFile does not support IBindStatusCallbackEx and cannot be used to download files over 4 gigabytes (GB) in size. Refer instead to IBindStatusCallbackEx::GetBindInfoEx for a code example.
Function Information
Stock Implementation urlmon.dllCustom Implementation NoHeader Urlmon.hImport library Urlmon.libMinimum availability Internet Explorer3.0Minimum operating systems Windows NT 4.0, Windows 95Unicode Implemented as ANSI and Unicode versions.
- URLDownloadToFile Function
- URLDownloadToFile Function
- URLDownloadToFile
- URLDownloadToFile
- URLDownloadToFile
- URLDownloadToFile
- URLDownloadToFile
- URLDownloadToFile
- URLDownloadToFile
- URLDownloadToFile函数
- (转)URLDownloadToFile
- URLDownloadToFile的BUG
- URLDownloadToFile 访问参数限制!
- 用URLDownloadToFile下载文件
- URLDownloadToFile进度回调
- 为 URLDownloadToFile 实现进度条
- internetopen、internetOpenUrl、InternetReadFile,urldownloadtofile
- vb URLDownloadToFile下载函数
- 35岁之前成功的12条黄金法则
- Java发送HTTP请求和提取数据的Java代码
- Dynamics CRM: Sharing vs. Assigning Advanced Find Views
- Java同一变量赋值的特殊性
- 阅读《基于MATLAB与VC混合编程的数字均衡器设计》的要点
- URLDownloadToFile Function
- Magento系统Url地址解析方式
- android中的ellipsize设置(省略号的问题)
- Android 方向传感器 + Low Pass Filter +补间动画的一个Demo
- configure: error: xml2-config not found. Please check your libxml2 installation.
- 电脑屏幕颜色不正常
- OpenCV学习笔记(四十五)——小试随机森林(random forest)算法ml
- 循环数
- PSP 编程导学(二)