您的位置:首页 > 其它

URLDownloadToFile函数

2008-04-03 09:44 441 查看
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 Pointer to the controlling IUnknown interface of the calling Microsoft ActiveX component (if the caller is an ActiveX component).

szURL Pointer to a string value containing the URL to be downloaded. Cannot be set to NULL.
szFileName

Pointer to a string value containing the name of the file to create for bits that come from the download.

dwReserved Reserved. Must be set to 0. lpfnCB Pointer to the caller's IBindStatusCallback interface. URLDownloadToFile calls this interface's IBindStatusCallback::OnProgress method on a connection activity, including the arrival of data. IBindStatusCallback::OnDataAvailable is never called.

#include "stdafx.h"
#include <iostream>
#include <UrlMon.h>
#pragma comment(lib, "urlmon.lib")

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
//nt * dl = new int;
HRESULT hr = URLDownloadToFile(0, _T("http://ui.the9.com/wowshell/WoWShell.exe"),_T("D://WoWShell.exe"), 0,NULL);

if (hr== S_OK)
{
cout<< "ok"<< endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: