Click here to Skip to main content
15,569,319 members
Articles / Desktop Programming / ATL
Posted 22 Dec 2002


39 bookmarked

A COM component offering Internet download utilities

Rate me:
Please Sign up or sign in to vote.
4.00/5 (5 votes)
22 Dec 20022 min read
A COM component written in C++ that offers functions for multiple parallel downloads, Internet cache access, URL and path resolving.

Sample Image - MyInetUtils.jpg


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

Interface IAsyncDownloader
Name Type Explanation
AbortDownload Method Abort downloading (does not work)
ConcurrentDownloads Property Get/Let Number of concurrent downloads
DownloadedBytes Property Get Downloaded bytes yet
MaxBytes Property Get Maximum bytes to download
RequestDownload Method Request Download
ResumeDownload Method Resume Download (does not work)
Status Property Get Status of download (in progress, etc.)
SuspendDownload Method Suspend Download (does not work)
Event Interface _IAsyncDownloaderEvents
OnData Event Data arrived
OnFinish Event Finished downloading
OnStart Event Started downloading

Object CacheUtils

Interface ICacheUtils
Name Type Explanation
CrackUrl Method Crack Url into a UrlComponents object (host,path,etc.)
DownloadToFile Method Download URL To local file
MakeSureDirectoryPathExists Method Make Sure Directory Path Exists
PathCombine Method Combine paths
SaveURLfileFromCacheToLocalfile Method Save URL file From Cache To Local file
UrlCombine Method Url Combine

Object UrlComponents

Interface IUrlComponents
Name Type Explanation
ExtraInfo Property Get/Let ExtraInfo
FullURL Property Get/Let FullURL
HostName Property Get/Let HostName
Password Property Get/Let Password
Port Property Get/Let Port
Scheme Property Get/Let Scheme
UrlPath Property Get/Let UrlPath
UserName Property Get/Let UserName

Object PathUtils

Interface IPathUtils
Name Type Explanation
GetFullPathName Method Get Full PathName
GetModuleFileName Method Get Module FileName
GetShortPathName Method Get Short PathName
MakeSureDirectoryPathExists Method Make Sure Directory Path Exists
PathCanonicalize Method Path Canonicalize
PathCombine Method Path Combine
PathCommonPrefix Method Path Common Prefix
PathFindFileName Method Path Find FileName
PathIsDirectory Method Path Is Directory
PathIsFileSpec Method Path Is File Spec
PathIsPrefix Method Path Is Prefix
PathIsRelative Method Path Is Relative
PathIsRoot Method Path Is Root
PathIsSameRoot Method Path Is Same Root
PathIsUNC Method Path Is UNC
PathIsURL Method Path Is URL
PathMatchSpec Method Path Match Spec
PathQuoteSpaces Method Path Quote Spaces
PathRelativePathTo Method Path Relative Path To
PathRemoveArgs Method Path Remove Args
PathRemoveBackslash Method Path Remove Backslash
PathRemoveBlanks Method Path Remove Blanks
PathRemoveExtension Method Path Remove Extension
PathRemoveFileSpec Method Path Remove File Spec
PathRenameExtension Method Path Rename Extension
UrlCombine Method Url Combine


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

Written By
Web Developer Forthnet
Greece Greece
Software developer and Microsoft Trainer, Athens, Greece (MCT,, MCSE 2003, MCDBA 2000,MCTS, MCITP, MCIPD).

Comments and Discussions

QuestionUndefined behavior? Pin
Humberto18-Aug-06 7:19
Humberto18-Aug-06 7:19 
QuestionIs it possible to get images from Database? Pin
Bill A Murray23-Nov-03 10:03
professionalBill A Murray23-Nov-03 10:03 
GeneralSave to file Pin
Supay25-Sep-03 5:25
Supay25-Sep-03 5:25 
GeneralRe: Save to file Pin
Philipos Sakellaropoulos29-Sep-03 11:16
professionalPhilipos Sakellaropoulos29-Sep-03 11:16 
QuestionHow to download a file again without copying from cache ? Pin
coffeedrunk1-Jun-03 19:07
coffeedrunk1-Jun-03 19:07 
AnswerI did it with DeleteUrlCacheEntry() Pin
coffeedrunk1-Jun-03 21:00
coffeedrunk1-Jun-03 21:00 
GeneralRun in browser Pin
johndue24-Apr-03 17:17
johndue24-Apr-03 17:17 
GeneralResume Pin
Todd Smith23-Dec-02 15:17
Todd Smith23-Dec-02 15: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.