Naughter Software Logo

CHTTPDownloadDlg, CHTTPDownloader, CHTTPDownloadDlg2 & CHTTPDownloader2 v1.42

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.42 (30 April 2022)

v1.41 (16 January 2021)

v1.40 (12 January 2020)

v1.39 (8 December 2019)

v1.38 (12 October 2019)

v1.37 (30 April 2019)

v1.36 (27 October 2018)

v1.35 (28 December 2017)

v1.34 (19 September 2017)

v1.33 (25 December 2016)

v1.32 (16 January 2016)

v1.31 (22 February 2015)

6 January 2014

v1.30 (08 June 2008)

v1.29 (11 May 2008)

v1.28 (30 December 2007)

v1.27 (10 June 2007)

v1.26 (17 September 2006)

v1.25 (25 August 2006)

v1.24 (16 July 2006)

v1.23 (15 July 2006)

v1.22 (2 July 2006)

v1.21 (8 May 2006)

v1.20 (4 April 2005)

v1.19 (5 March 2005)

v1.18 (11 November 2004)

v1.17 (12 February 2004)

v1.16 (5 February 2004)

v1.15 (29 June 2003)

v1.14 (19 January 2003)

v1.13 (6 January 2003)

v1.12 (30 October 2002)

v1.11 (20 April 2002)

v1.10 (2 February 2002)

v1.09 (3 December 2001)

v1.08 (10 October 2001)

v1.07 (17 June 2001)

v1.06 (28 April 2001)

v1.05 (2 July 2000)

v1.04 (12 June 2000)

v1.03 (25 January 2000)

v1.02 (29 November 1999)

v1.01 (15 November 1999)

v1.0 (14 November 1999)