Click here to Skip to main content
15,895,839 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.5K   5.7K   108  
A class that allows you to create self extracting executables for use in distribution or setup programs
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_EXTRACTOR_DIALOG DIALOG DISCARDABLE  0, 0, 275, 113
STYLE DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | 
    WS_CAPTION | WS_SYSMENU
CAPTION "Self Extractor"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "&Extract",IDC_EXTRACT,223,7,45,14
    PUSHBUTTON      "&Browse",IDC_BROWSE,223,23,45,14
    EDITTEXT        IDC_PATH,39,34,175,12,ES_AUTOHSCROLL
    PUSHBUTTON      "&About...",IDC_ABOUT,223,39,45,14
    PUSHBUTTON      "E&xit",IDCANCEL,223,55,45,14
    ICON            IDR_MAINFRAME,-1,7,5,20,20
    LTEXT           "Use the Browse button to choose the folder where you would like to extract the files and then click on the Extract button when your are ready.",
                    IDC_INTRO_TEXT,39,7,175,26
    CONTROL         "Progress1",IDC_PROGRESS,"msctls_progress32",WS_BORDER,
                    39,60,175,14
    CONTROL         "Progress1",IDC_ZIP_PROGRESS,"msctls_progress32",
                    WS_BORDER,39,86,175,14
    LTEXT           "Total Progress",IDC_TOTAL_STATUS,39,50,46,8
    LTEXT           "Current File",IDC_FILE_STATUS,39,76,36,8
END


#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x29L
#else
 FILEFLAGS 0x28L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "080904b0"
        BEGIN
            VALUE "CompanyName", "Lyme Software\0"
            VALUE "FileDescription", "Lyme SFX Extractor\0"
            VALUE "FileVersion", "1.00\0"
            VALUE "InternalName", "Extractor\0"
            VALUE "LegalCopyright", "Copyright � Lyme Software 1999\0"
            VALUE "OriginalFilename", "Extractor.exe\0"
            VALUE "PrivateBuild", "96\0"
            VALUE "ProductName", "Lyme SFX Extractor\0"
            VALUE "ProductVersion", "1.00\0"
            VALUE "SpecialBuild", "96\0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x809, 1200
    END
END

#endif    // !_MAC


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_EXTRACTOR_DIALOG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 268
        TOPMARGIN, 7
        BOTTOMMARGIN, 106
    END
END
#endif    // APSTUDIO_INVOKED

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "#ifdef _WIN32\r\n"
    "LANGUAGE 9, 1\r\n"
    "#pragma code_page(1252)\r\n"
    "#endif\r\n"
    "#include ""res\\Extractor.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""         // Standard components\r\n"
    "#endif\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME           ICON    DISCARDABLE     "res\\Extractor.ico"

/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_INTRO_TEXT          "Use the Browse button to choose the folder where you would like to extract the files and then click on the Extract button when your are ready."
    IDS_NO_DATA_INTRO       "This self-extracting archive contains no data. Make sure that you downloaded it correctly."
    IDS_NOTHING_TO_DO       "Archive contins no data. Extraction cannot continue."
    IDS_OUTFILE_ERROR       "Extractor Experienced Problems Creating Output File. Pleaseensure that you have enough space on the target drive."
    IDS_DEFAULT_ERROR       "Internal Error"
    IDS_SUCCESS_FORMATTER   "%d files extracted successfully"
END

#endif    // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif
#include "res\Extractor.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"         // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

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