Today, see Urlmon.h file, see several other download functions, if you use other people do not use the Urldownloadtofile function, write to download, will not be killed?
Start the Search function URLDownloadToCacheFile (MSDN: http://msdn.microsoft.com/library/default.asp?url=/workshop/net .../ functions/urldownloadtocachefile.asp), literally means downloading files to a cached file, using the MSDN search method, After performing a download, the file is downloaded to the cache folder of IE. later find the path to get IE cache folder, and Google for a few minutes, finally found a suitable api:geturlcacheentryinfo (MSDN:http:// msdn2.microsoft.com/en-us/library/aa384185.aspx)
So the following code is available:
#include <urlmon.h>
#include <Wininet.h>
#include <stdio.h>
#pragma comment (lib, "Urlmon.lib")
#pragma comment (lib, "Wininet.lib")
#pragma COMMENT (linker, "/opt:nowin98")
#pragma COMMENT (linker, "/merge:.rdata=.text")
#define SZURL "Http://www.spr1t3.com/hello.exe"
void Main (int argc,char * * argv)
{
URLDownloadToCacheFile (Null,szurl, "C:\1.exe", 50,0,null);
DWORD dwentrysize=0;
Lpinternet_cache_entry_info Lpcacheentry;
Char strtemp[255];
if (! Geturlcacheentryinfo (szurl,null,&dwentrysize))
{
if (GetLastError ()!=error_insufficient_buffer)
{
Return
}
Else