void getfilelist(const char*Url,char*taskfile)
{
HINTERNET hSession = InternetOpen("RookIE/1.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, NULL);
if (hSession != NULL)
{
HINTERNET handle2 = InternetOpenUrl(hSession, Url, NULL, 0, INTERNET_FLAG_DONT_CACHE, 0);
if (handle2 != NULL)
{
//cout<<Url<<endl;
ULONG Number = 1;
char _temp[1024]={0};
ofstream ofs(taskfile);
if(ofs)
{
while(Number>0)
{
InternetReadFile(handle2, _temp, MAXBLOCKSIZE - 1, &Number);
ofs<<_temp;
}
ofs.close();
}
InternetCloseHandle(handle2);
handle2 = NULL;
}
else
{
cout<<"internetOpenUrl error!";
}
InternetCloseHandle(hSession);
hSession = NULL;
}
else
{
cout<<"internetOpen error!";
}
}
URLDownloadToFile(NULL,(LPCTSTR)Url,(LPCTSTR)taskfile,0,NULL)
***如果下载同一个url的话,要清除缓存:DeleteUrlCacheEntry(Url);