Click here to Skip to main content
11,720,545 members (67,823 online)
Click here to Skip to main content

A COM component offering Internet download utilities

, 22 Dec 2002 59.2K 1.6K 39
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

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

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...

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    Rant Rant    Admin Admin   

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

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