Batch API implementation file download code 1th/2 page _dos/bat

Source: Internet
Author: User
Tags function prototype
Author: ZV (Zvrop)
Directory:
I wrote it in front of me.
Two. The cause of the story
Three. Settlement-Draft worked out
Four. Solve-combat
Five. Solve-build
Six. Packaging
Seven. Subsection
Eight. PostScript
Nine. Reference documents


Body Start:

I wrote it in front of me.
This document is not about the new technology, I just played them together to achieve the function of their needs, if you have a good understanding of batch processing and PE format, then my document as a browsing review ... ^_^ ...
In addition, because I am a lot of nonsense, this is not to write the magazine's main reason for writing, give me a shriveled 3000 words can tell what to do, as there is no restrictions on the straightforward (of course, there is no remuneration ...). One _ one ...), so also in order to prevent you to read the article on the way to sleep, please bring a small awl ...
Finally, this document is to use a batch download file, in fact it contains a lot of knowledge, if there is time, may wish to see Kazakhstan, ^_^, began to buy melons.

Two. The cause of the story

The idea was that, not so long ago, a member of the UNIX shell Board on the Forum (AD http://www.s8s8.net) posted a post with a script for a mass download of the picture, written in bash shell (actually h picture ...). One _ one ..., the next to follow that much ah ..., there are multiply out of PHP, VBS, C, #, Java, and even communicate to multiple threads, breakpoint continued .... Quote Flower eldest brother "no words, for mm photos, everyone's motivation is very foot ah!" "... Khan ~ ~ ...

After sending a copy of PHP and C code (I feel the power of the super ... One _ one., it's very simple (because using scripts such as C or php to download a file is a very basic thing) I began to want to use Microsoft's most original script--batch (batch processing) to try to implement (the title of this article "idle" is to commemorate here, one _ one.), it seems a little weird Because the batch processing has almost no support network functionality (of course, if you say you can download the file with Telnet, I am very impressed.) One _ one ...), but also is not completely no way, after all, Windows can use things so much, not finished things .... In the seduction of this challenge, I finished the function of downloading files with batch processing .... Now let me replay my thoughts step-by-step, uncover the mystery of downloading files with batch processing ...


Three. Settlement-Draft worked out

If you download a file with a batch, you'll immediately think of the Cscript script (or Java script), which is, of course, Too many batch scripts implement functions that are not possible by themselves and are resolved by using echo out of one of the other scripts. But our goal is to use the batch process to achieve the download function, if you want to use the VBS to help the words as a direct write VBS. The idea went down ...

Come on, remember there was a pop. Using RUNDLL32 to load APIs in DLLs seems to be a bit more than we need, because there are too many APIs to download files, and if Rundll can call, that's best. So I opened MSDN and I found an API: Urldownloadtofile

Urldownloadtofile function Prototype:

Code

HRESULT Urldownloadtofile (
Lpunknown Pcaller,
LPCTSTR Szurl,
LPCTSTR szFileName,
DWORD dwreserved,
Lpbindstatuscallback LPFNCB
);




Some information about the Urldownloadtofile function:


Reference

Header Urlmon.h
Import Library Urlmon.lib
Minimum Availability Internet Explorer 3.0
Minimum operating systems Windows NT 4.0, Windows 95


Current 1/2 page 12 Next read the full text

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.