Click here to Skip to main content
15,896,207 members
Articles / Desktop Programming / MFC

Creating a Self Extracting Executable

Rate me:
Please Sign up or sign in to vote.
4.98/5 (22 votes)
20 Aug 2002CPOL3 min read 309.6K   5.7K   108  
A class that allows you to create self extracting executables for use in distribution or setup programs
// Extractor BuilderDlg.h : header file
//

#if !defined(AFX_EXTRACTORBUILDERDLG_H__5C3D7755_497B_11D3_A8BC_0050043A01C0__INCLUDED_)
#define AFX_EXTRACTORBUILDERDLG_H__5C3D7755_497B_11D3_A8BC_0050043A01C0__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "SelfExtractor.h"
#include "DirDialog.h"
#include "TextProgressCtrl.h"

/////////////////////////////////////////////////////////////////////////////
// CExtractorBuilderDlg dialog

class CExtractorBuilderDlg : public CDialog
{
// Construction
public:
	CExtractorBuilderDlg(CWnd* pParent = NULL);	// standard constructor

	CString GetWorkingDir(BOOL withBackSlash = FALSE);
	void UpdateList();

	static void AddCallBack(int nMsgType, void* CallbackData, void* UserData);

	CSelfExtractor	m_Extractor;
	CString			m_strWorkingDir;

// Dialog Data
	//{{AFX_DATA(CExtractorBuilderDlg)
	enum { IDD = IDD_EXTRACTORBUILDER_DIALOG };
	CTextProgressCtrl	m_ZipProgress;
	CTextProgressCtrl	m_Progress;
	CListCtrl	m_List;
	CString	m_strExePath;
	CString	m_strExtractorPath;
	CString	m_strCurrFile;
	CString	m_strZipInfo;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CExtractorBuilderDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CExtractorBuilderDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnBrowseexe();
	afx_msg void OnBrowsezip();
	afx_msg void OnCreate();
	afx_msg void OnRead();
	afx_msg void OnBrowseExtractor();
	afx_msg void OnAddDir();
	afx_msg void OnAddFiles();
	afx_msg void OnClearList();
	afx_msg void OnAbout();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EXTRACTORBUILDERDLG_H__5C3D7755_497B_11D3_A8BC_0050043A01C0__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United Kingdom United Kingdom
James is currently working as a Software Engineer providing large scale Warehouse Management Systems and Airport Baggage Handling Systems. He is a Windows specialist but nowadays spends about 65% of his time fighting with VI in a vain attempt to get his UNIX C code to compile. He has been programming in C/C++ for 6 years and Visual C++/MFC for 4 years.

In his spare time James plays a variety of musical instruments including guitar and piano with varying degrees of success. He has been told he spends too much time and money in the pub but doesn't everyone have their own stool at the bar?

James is originally from Nottingham (no Robin Hood jokes please) but is now based in sunny Manchester, UK.

The attached photo shows James in his favourite position, drinking beer with a hand growing out of his neck.

Comments and Discussions