Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A COM component offering Internet download utilities

0.00/5 (No votes)
22 Dec 2002 1  
A COM component written in C++ that offers functions for multiple parallel downloads, Internet cache access, URL and path resolving.

Sample Image - MyInetUtils.jpg

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

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

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