//folder C:/vector1 and C:/vector1/vector1 must exist
#include <windows.h>
#include <stdio.h>
typedef HRESULT (WINAPI *UDTF)(LPVOID, LPCTSTR, LPCTSTR, DWORD, LPVOID);
int main(void)
{
int r = 1;
HMODULE hDll;
UDTF URLDownloadToFile;
//string url = "
http://www.axmag.com/download/pdfurl-guide.pdf";
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if((hDll = LoadLibrary("urlmon")))
{
if((URLDownloadToFile = (UDTF)GetProcAddress(hDll, "URLDownloadToFileA")))
{
if(URLDownloadToFile(0, "
http://www.axmag.com/download/pdfurl-guide.pdf", "C:/vector1/pdf.pdf", 0, 0) == 0)
r = 0;
}
FreeLibrary(hDll);
}
printf("%s\n", r ? "Echec" : "Ok");
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if((hDll = LoadLibrary("urlmon")))
{
if((URLDownloadToFile = (UDTF)GetProcAddress(hDll, "URLDownloadToFileA")))
{
if(URLDownloadToFile(0, "
http://www.axmag.com/download/pdfurl-guide.pdf", "C:/vector1/vector1/pdf.pdf", 0, 0) == 0)
r = 0;
}
FreeLibrary(hDll);
}
printf("%s\n", r ? "Echec" : "Ok");
getchar();
return r;
}