Downloading HTML pages from internet

Hi pals,
I am working on a small project which consists of making a download manager. I have broken the software in three parts. (i) Downloading jpgs and bmps, (ii) Downloading zip files (iii) Downloading HTML pages. I have successfully completed the first two parts, by receiving the header of the jpegs, and zips, but in HTML, the header turns out to be zero. The flaw in my code is that it downloads the entries which are resumeable, break them in eight sections and downloads section wise. I am very much confused how to proceed in HTML download. Kindly send me a quick small code, which can download HTML files. The code should be independant from any such ocx or dll which is not easily available or is shareware, coz I can not afford to spend money on this learning project. With this I offer you to send me emails if you want to get the source code of the rest of the download manager.

Wish you happy programming :)

A W Abid
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    Dim lngRetVal As Long
    lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    If lngRetVal = 0 Then DownloadFile = True
End Function

Function MatchVersion()
    DownloadFile "", "c:\index.html"
End Function

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
> With this I offer you to send me emails if you want to get the source code of the rest of the download manager.

I would like to look at the source for your download, what e-mail address should I sent the request to?

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Richie_SimonettiIT OperationsCommented:
I modified Urldownloadtofile to manage file names dinamically. You could see it as part of

Richie_SimonettiIT OperationsCommented:
By the way, that API let you download all files not only HTML ones.
Richie_SimonettiIT OperationsCommented:
awabidAuthor Commented:
My email address is please send me the mail with the subject DOWNLOAD MANAGER. Praying to God that u like the way ...lolz

Happy Programming :)
A W ABid

personally I would strongly suggest not to use URLDownloadToFile API if you want to create a professional download manager.

Reason : Proxy...

this API runs with your Internet Explorer settings. Now I have a system setup where Internet Explorer is set to check pages from my Internal Server (websites designed), and I use MYIE for browsing...

any program using URLDownloadToFile will fail, as the address will not be available on my local server...

where as something like GetRight will give me an option to use use whatever I want, may it be a proxy or no proxy.. WinSock is really the only way to do it.
awabidAuthor Commented:
Hi Pals,
thank you so much for your kind support. I kept this question open for few days if anybody can pour in, and a couple of good ideas are there. To be true i am really confused, whom answer should be accepted and whom should be rejected. Nevertheless you can see the result.

Happy typing :)

A W Abid
awabidAuthor Commented:
By the way, i got the results from the accepted answer, but there were few more things which should be clarified. And it worked :) Everybody good job done!!!

Happy lunch :)

A W Abid
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.