Click here to Skip to main content
15,885,216 members
Articles / Desktop Programming / MFC
Article

CHttpDownloadDlg v1.03

Rate me:
Please Sign up or sign in to vote.
4.81/5 (18 votes)
3 Mar 2000 215.7K   5.7K   97   51
A dialog implementation that performs HTTP downloads.
  • Download source files - 42 Kb
  • Sample Image - DownloadDlg.gif

    Introduction

    Welcome to CHttpDownloadDlg, an MFC dialog which performs HTTP downloads similar to the Internet Explorer download dialog as shown above.


    History
    Usage
    Contacting the Author


    History

    V1.0 (14 November 1999)
    • First public release.

    V1.01 (15 November 1999)

    • Updated documentation to refer to what rc resources are needed by the class.
    • Renamed all resources used from ASYNC_DOWLOAD to include HTTPDOWNLOAD.
    • Now handles HTTP error 407 (Proxy Authentication) and HTTP error 401 (Server Authentication). You are prompted with a password dialog when either of these forms of authentication are required.
    • Sample program now allows you to specify the URL to download from as well as the file to download into and the username and password to connect with.
    • The download file is now deleted if the download was aborted or if some other error occurs during the download.
    • Parsing of URL will now work where "http://" is not explicitely specified.
    • Improved the general look and feel of the demo app and called it "HTML File Downloader".

    V1.02 (29 November 1999)

    • Fixed a number of compiler warnings and errors when used in VC++ 6.0.

    V1.03 (25 January 2000)

    • Fixed a problem where server authentication was not being detected correctly, while proxy authentication was being handled.
    • Updated the way and periodicity certain UI controls are updated during the HTTP download.


    Usage

    To use CHttpDownloadDlg in your project simply include HttpDownloadDlg.cpp/.h from the test application in your application and #include "HttpDownloadDlg.h" in whichever files you want to use the class in. To bring up the dialog to download a specific file, just use some code like the following:

    CHttpDownloadDlg dlg;
    dlg.m_sURLToDownload = _T("http://www.some-site.com/somefile.ext");
    dlg.m_sFileToDownloadInto = _T("c:\\somfile.ext");
    if (dlg.DoModal() == IDOK)
       AfxMessageBox("File was downloaded successfully");

    You should also have a look at the CInetDownloadDlg::OnDownload() code in the sample application.


    Contacting the Author

    PJ Naughter
    Email: pjn@indigo..ie
    Web: http://www.naughter.com
    25 January 2000


    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


    Written By
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralRe: ProgressBar is not working properly Pin
    pjnaughter28-Jun-03 4:38
    pjnaughter28-Jun-03 4:38 
    GeneralRe: ProgressBar is not working properly Pin
    pjnaughter29-Jun-03 2:17
    pjnaughter29-Jun-03 2:17 
    Generalwonderful job,but small problem Pin
    marutis3-Mar-02 22:21
    marutis3-Mar-02 22:21 
    GeneralDownloading only a part of a file Pin
    11-Nov-01 12:59
    suss11-Nov-01 12:59 
    GeneralRe: Downloading only a part of a file Pin
    pjnaughter10-Jan-03 10:26
    pjnaughter10-Jan-03 10:26 
    GeneralNew Version Pin
    17-Sep-01 11:47
    suss17-Sep-01 11:47 
    QuestionSame class without the dialog? Pin
    26-Jul-01 8:11
    suss26-Jul-01 8:11 
    AnswerRe: Same class without the dialog? Pin
    pjnaughter10-Jan-03 10:28
    pjnaughter10-Jan-03 10:28 
    You should be able to achieve this affect by playing around with the visibility window atrribute of the dialog resource I use.
    GeneralMinor bug in Authentication code Pin
    23-Jul-01 1:55
    suss23-Jul-01 1:55 
    GeneralHTTPS Pin
    29-Jun-01 3:16
    suss29-Jun-01 3:16 
    GeneralCannot download EXE and DLL files Pin
    Rajneesh Sehgal18-Jan-01 6:37
    Rajneesh Sehgal18-Jan-01 6:37 
    GeneralRe: Cannot download EXE and DLL files Pin
    pjnaughter10-Jan-03 10:31
    pjnaughter10-Jan-03 10:31 
    GeneralRe: Cannot download EXE and DLL files Pin
    Anonymous10-Jan-03 16:32
    Anonymous10-Jan-03 16:32 
    GeneralI want to apply this class to another project.... but Pin
    Member 240711-Apr-00 16:14
    Member 240711-Apr-00 16:14 
    GeneralRe: I want to apply this class to another project.... but Pin
    pjnaughter16-May-00 13:52
    pjnaughter16-May-00 13:52 
    GeneralRe: I want to apply this class to another project.... but Pin
    mindows11-Feb-03 13:34
    mindows11-Feb-03 13:34 
    GeneralRe: I want to apply this class to another project.... but Pin
    pjnaughter11-Feb-03 23:51
    pjnaughter11-Feb-03 23:51 

    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.