Click here to Skip to main content
13,042,630 members (76,646 online)
Click here to Skip to main content
Add your own
alternative version

Stats

61.5K views
39 bookmarked
Posted 22 Dec 2002

A COM component offering Internet download utilities

Rate this:
Please Sign up or sign in to vote.
A COM component written in C++ that offers functions for multiple parallel downloads, Internet cache access, URL and path resolving.
<!-- Download Links --> <!-- Article image -->

Sample Image - MyInetUtils.jpg

<!-- Add the rest of your HTML here -->

Introduction

A year ago I wanted to create a large multi-download program. I implemented the visual interface in VB6 and the actual download functionality in an ATL COM component. I used the URL monikers and specifically the CBindStatusCallback ATL class to implement downloading. Unfortunately the documentation for URL monikers is poor and I have only scratched the surface of this subject. I have not yet succeeded in implementing suspend and resume of downloads. The component also includes some other useful functions for cache access, URL and resolving of paths. I hope you'll find it useful. The figure above shows a small VB6 program that simultaneously downloads 3 files from the Microsoft download site.

Below there is a brief listing of the interface methods. In the source code zip file, you'll find also an HtmlHelp, created with my 'Automatic HTMLHelp Documentation' tool.

Object AsyncDownloader

</table border="1">

Object CacheUtils

Interface IAsyncDownloader
NameTypeExplanation
AbortDownloadMethodAbort downloading (does not work)
ConcurrentDownloadsProperty Get/LetNumber of concurrent downloads
DownloadedBytesProperty GetDownloaded bytes yet
MaxBytesProperty GetMaximum bytes to download
RequestDownloadMethodRequest Download
ResumeDownloadMethodResume Download (does not work)
StatusProperty GetStatus of download (in progress, etc.)
SuspendDownloadMethodSuspend Download (does not work)
Event Interface _IAsyncDownloaderEvents
OnDataEventData arrived
OnFinishEventFinished downloading
OnStartEventStarted downloading
Interface ICacheUtils
NameTypeExplanation
CrackUrlMethodCrack Url into a UrlComponents object (host,path,etc.)
DownloadToFileMethodDownload URL To local file
MakeSureDirectoryPathExistsMethodMake Sure Directory Path Exists
PathCombineMethodCombine paths
SaveURLfileFromCacheToLocalfileMethodSave URL file From Cache To Local file
UrlCombineMethodUrl Combine

Object UrlComponents

Interface IUrlComponents
NameTypeExplanation
ExtraInfoProperty Get/LetExtraInfo
FullURLProperty Get/LetFullURL
HostNameProperty Get/LetHostName
PasswordProperty Get/LetPassword
PortProperty Get/LetPort
SchemeProperty Get/LetScheme
UrlPathProperty Get/LetUrlPath
UserNameProperty Get/LetUserName

Object PathUtils

Interface IPathUtils
NameTypeExplanation
GetFullPathNameMethodGet Full PathName
GetModuleFileNameMethodGet Module FileName
GetShortPathNameMethodGet Short PathName
MakeSureDirectoryPathExistsMethodMake Sure Directory Path Exists
PathCanonicalizeMethodPath Canonicalize
PathCombineMethodPath Combine
PathCommonPrefixMethodPath Common Prefix
PathFindFileNameMethodPath Find FileName
PathIsDirectoryMethodPath Is Directory
PathIsFileSpecMethodPath Is File Spec
PathIsPrefixMethodPath Is Prefix
PathIsRelativeMethodPath Is Relative
PathIsRootMethodPath Is Root
PathIsSameRootMethodPath Is Same Root
PathIsUNCMethodPath Is UNC
PathIsURLMethodPath Is URL
PathMatchSpecMethodPath Match Spec
PathQuoteSpacesMethodPath Quote Spaces
PathRelativePathToMethodPath Relative Path To
PathRemoveArgsMethodPath Remove Args
PathRemoveBackslashMethodPath Remove Backslash
PathRemoveBlanksMethodPath Remove Blanks
PathRemoveExtensionMethodPath Remove Extension
PathRemoveFileSpecMethodPath Remove File Spec
PathRenameExtensionMethodPath Rename Extension
UrlCombineMethodUrl Combine

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Philipos Sakellaropoulos
Web Developer
Greece Greece
Software developer and Microsoft Trainer, Athens, Greece (MCT, MCSD.net, MCSE 2003, MCDBA 2000,MCTS, MCITP, MCIPD).

You may also be interested in...

Pro
Pro

Comments and Discussions

 
QuestionUndefined behavior? Pin
Humberto18-Aug-06 6:19
memberHumberto18-Aug-06 6:19 
QuestionIs it possible to get images from Database? Pin
Bill Murray23-Nov-03 9:03
memberBill Murray23-Nov-03 9:03 
GeneralSave to file Pin
Supay25-Sep-03 4:25
sussSupay25-Sep-03 4:25 
GeneralRe: Save to file Pin
Philipos Sakellaropoulos29-Sep-03 10:16
memberPhilipos Sakellaropoulos29-Sep-03 10:16 
QuestionHow to download a file again without copying from cache ? Pin
piggybank1-Jun-03 18:07
memberpiggybank1-Jun-03 18:07 
AnswerI did it with DeleteUrlCacheEntry() Pin
piggybank1-Jun-03 20:00
memberpiggybank1-Jun-03 20:00 
GeneralRun in browser Pin
johndue24-Apr-03 16:17
memberjohndue24-Apr-03 16:17 
GeneralResume Pin
Todd Smith23-Dec-02 14:17
memberTodd Smith23-Dec-02 14:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170713.1 | Last Updated 23 Dec 2002
Article Copyright 2002 by Philipos Sakellaropoulos
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid