Naughter Software Logo

CHTTPDownloadDlg, CHTTPDownloader, CHTTPDownloadDlg2 & CHTTPDownloader2 v1.33

The first class implements an MFC CDialog derived class which performs HTTP downloads similar to the old Internet Explorer download dialog as shown below:

CHttpDownloadDlg screen capture

 

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:\\somefile.ext");
if (dlg.DoModal() == IDOK)
    AfxMessageBox(_T("File was downloaded successfully"));

 

The CHTTPDownloader class is used internally by CHTTPDownloadDlg and allows you to operate in a synchronous non-UI manner as follows:

CHTTPDownloader downloader;
downloader.m_Settings.m_sURLToDownload = _T("http://www.some-site.com/somefile.ext");
downloader.m_Settings.m_sFileToDownloadInto = _T("c:\\somefile.ext");
downloader.Download();
 

Finally if you want to use the WinHTTP stack instead of Wininet, then you can use CHTTPDownloadDlg2 and CHTTPDownloader2 instead of CHTTPDownloadDlg and CHTTPDownloader.

The enclosed zip file contains the CHTTPDownloadDlg, CHTTPDownloader, CHTTPDownloadDlg2 & CHTTPDownloader2 source code and 2 simple MFC dialog based programs which exercises the classes.

 

Copyright

 

Updates

V1.0 (14 November 1999)

V1.01 (15 November 1999)

V1.02 (29 November 1999)

V1.03 (25 January 2000)

V1.04 (12 June 2000)

V1.05 (2 July 2000)

V1.06 (28 April 2001)

V1.07 (17 June 2001)

V1.08 (10 October 2001)

V1.09 (3 December 2001)

V1.10 (2 February 2002)

V1.11 (20 April 2002)

V1.12 (30 October 2002)

V1.13 (6 January 2003)

V1.14 (19 January 2003)

V1.15 (29 June 2003)

V1.16 (5 February 2004)

V1.17 (12 February 2004)

V1.18 (11 November 2004)

V1.19 (5 March 2005)

V1.20 (4 April 2005)

V1.21 (8 May 2006)

V1.22 (2 July 2006)

V1.23 (15 July 2006)

V1.24 (16 July 2006)

V1.25 (25 August 2006)

V1.26 (17 September 2006)

V1.27 (10 June 2007)

V1.28 (30 December 2007)

V1.29 (11 May 2008)

V1.30 (08 June 2008)

6 January 2014

V1.31 (22 February 2015)

V1.32 (16 January 2016)

V1.33 (25 December 2016)