#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <Windows.h>
#include <iostream>
#include <vector>
#include <string>
#include <urlmon.h>
#pragma comment(lib,"urlmon.lib")
class HttpDownloader{
public:
HttpDownloader();
~HttpDownloader();
bool DownloadRes(std::wstring url,std::wstring res_name=L"");
};
#include "HttpDownloader.h"
using namespace std;
HttpDownloader::HttpDownloader()
{
}
HttpDownloader::~HttpDownloader()
{
}
bool HttpDownloader::DownloadRes(std::wstring url,std::wstring res_name)
{
URLDownloadToFile(nullptr,url.c_str(),res_name.c_str(),0,nullptr);
return true;
}
unique_ptr<HttpDownloader> hd(new HttpDownloader());
std::wstring demo = L"http://pic104.nipic.com/file/20160715/6171480_185807154956_2.jpg";
std::wstring save_name = L"DENM.jpg";
hd->DownloadRes(demo,save_name);
system("pause");