URLDownloadToFile函数

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
#include
#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;
}

 

你可能感兴趣的:(URLDownloadToFile函数)