Click here to Skip to main content
15,396,210 members
Articles / Desktop Programming / MFC
Posted 18 Nov 2004


155 bookmarked

Easy Installer

Rate me:
Please Sign up or sign in to vote.
4.81/5 (57 votes)
14 Sep 2006CPOL11 min read
The Easy Installer program

For those who want a ridiculously simple installer, here's the original EasyInstaller version 1.

Create Installer screenshot

Target Installer screenshot

Latest updates

Version 2.4 - Added Vista as one of the Windows version options, and fixed a few bugs.

Version 2

This release has the following enhancements:

  • Improved user interface - The target installer is now Wizard style.
  • License page - The user can specify an optional license page to be displayed in the installer. The one displayed in the installer for the executable is a somewhat shameless copy-job and adaptation of the Info-Zip license found in the zip.cpp file.
  • Information page - The user can have an optional information page displayed in the installer which can be used to inform the user of new features or special details.
  • Check if project EXEs are running - The installer now checks if any of the EXEs in the project are running before continuing with the installation.

Still to be done (not necessarily by me :-)

  • Progress and completion pages - It would be nice to have a progress page after the user clicks "Finish" so that there is some idea of what's happening. Then an "Install successfully completed" gives the user that warm fuzzy feeling that he did something right.
  • Tabbed(?) interface for the CreateInstaller - The user interface for the CreateInstaller program is a bit crowded. However, since I personally prefer seeing all the details in one shot instead of having to page through the different tabs, I left it the way it is. This also saves me the effort of making changes to the program. If one more install item is added in the future, the user interface will probably require some sort of makeover.
  • Relative pathnames for files - This would allow the files to be installed in different locations. I'm not exactly sure what the best way (user interface) to do this is. Once that's figured out, the code will follow. No matter, I'm frankly just too lazy to think about it right now.


I needed a simple install program for a Shareware/Fairware program of mine, but I just couldn't find anything suitable for my needs. I wanted a reasonably automatic creation of an installation executable, but I didn't want to spend hours learning scripts or complicated setups. After a protracted search, I found a couple of nice programs that created SFX files (self extracting executables), but I either had trouble compiling them, or they just didn't behave the way that I wanted.

After a while, I found the ExeCreator Utility, a nice little SFX builder written by Kaushal Malhotra. It too didn't really give me what I wanted. It wasn't enough for me to just be able to pack up my files into an SFX. However, it gave me a direction and a good start. I then decided it was time to get down on my hands and knees and start playing with Lego (tm). ExeCreator would function as that large green piece of Lego that serves as the base. The rest of the pieces are as follows (new stuff in bold):

  • Compression - The resulting install file was too big, so I needed a compression utility. Lucian Wischik's Zip Utils was just what I was looking for. Lucian's Utils are an easy-to-use repackaged form of the Info-Zip source code available here. In a matter of minutes, I had a compressed SFX. For version 2, I needed to apply the fixes as described in this forum thread. This is because I decided to zip all of the files together into one big ZIP instead of each file being zipped separately as in the first version.
  • Shortcuts - Most installers let the user create Desktop, Start menu, and Startup shortcuts. I found some code to do this that I had been playing around with some time ago that I believe was based on the works by PJ Naughter and Igor Vigdorchik.
  • Website link - To include a website link in the installer program, I used XHyperLink by Hans Dietrich.
  • Project configuration - I wanted the option of defining and saving install projects. I added some code for saving the project settings in an INI file. This file sits in the same directory as the CreateInstaller program, and can be easily moved to other machines if needed. I don't like using the registry - it's sort of a religious thing with me.
  • Windows versions - Since my Fairware program only runs on Windows 2K and XP, I figured I should add a way for the user to specify which versions of Windows the installation should work for. For this, I used the GetWinVer function by Hans Dietrich in his FontFile demo.
  • Install path creation - The Windows function _access() checks to see if the install directory path already exists. If the directory doesn't exist, MakeSurePathExists() by Arlen Albert creates each directory of the path until arriving at the final destination directory. MakeSurePathExists() is now being used since Microsoft's MakeSureDirectoryPathExists() is not available on Win 95/98/NT.
  • Register DLLs - The DLL is first checked to see if it can be registered. If so, WinExec() calls "regsvr32.exe". According to the MSDN, WinExec() only exists for compatibility with 16 bit Windows, and CreateProcess() should be used instead. I read the material on CreateProcess three times, and I still don't understand it. I'm either lazy or stupid (maybe both), but I don't care. WinExec() works just fine, so for me, it's a great choice.
  • Detect if the project EXEs are currently executing - The installer now checks if any of the EXEs in the project are running. If so, it prompts the user to close all of the programs before continuing with the installation. For the life of me, I can't remember where I found the code for this. If anyone knows, please let me know and I'll include the appropriate acknowledgment here.
  • Wizard installer - I figured that the best way to improve the appearance of the installer was to turn it into a Wizard. I found a nice Wizard project by Robert Pittenger on CodeProject which fits the bill.

After all this, Kaushal's code is no longer recognizable. For that matter, it's damn near impossible to find. But nonetheless, it still serves as a sturdy Lego base for Easy Installer, and it's what gave me the start.


I wanted an easy-to-use installer and I'm pretty happy with the results. No scripts and no complex tasks means no learning curve.

EasyInstaller is not meant to be a vote getter, and it will certainly never rival InstallShield. It's just a little something I cobbled together for my own use. I'm pretty happy with the results, and I'm using it to distribute my Fairware program. To be honest, the version that I am using (or at least was using) was a lot less polished than the version that I'm submitting. It didn't seem right to submit a mess and expect others to be able to benefit.

If you find it useful, that's great. If you think it's missing something, then let me know and I'll see what I can do. If what you think it's missing is scripting, then forget it. I can almost promise that EasyInstaller will never have scripting.

Using the installer

Projects can be named and defined. Defining a project is very simple. After giving it a name, you add the files that you would like to be packaged into the installer, check the Windows versions, and assign it an output name. You can optionally provide a website link. Fill in the caption and URL fields. If only a URL is provided (with no caption), then the URL will be displayed as-is in the installer. If a URL is not provided, then no link will appear in the installer. When you click "Create", it creates the executable that will serve as the installer. The current settings are also saved in an .ini file found in the same directory as the CreateInstaller executable. Click "Save project" to save the changes without creating an installer.

Projects can be modified or copied. Select a project from the list and modify the settings. If you give it a new name, you've created a new project. If you no longer need a project, select that project from the list and click "Delete project".

New in ver 2 - When creating an installer, you can now optionally point to a license agreement file and an information file. These will be displayed on their own pages in the target installer Wizard.

New in ver 2 - The install that's created checks to see if an executable with the name of the current project (e.g.: CurrentProject.exe) is currently running. If so, it informs the user that the program must be terminated before continuing with the installation.

The installer allows the user to ask for a Desktop shortcut as well as a Startup shortcut. The only requirement is that the .exe file to have shortcuts must have the same name as the project. As an example, if you have a project named SuperApp, it will create Desktop and Startup shortcuts to SuperApp.exe. I hope to make this feature a little more flexible in a future version.

If the user selects Start menu links to be created, then the installer will create a link for all executables in a Start menu directory that has the name as the project.

My code

OK, before you get frustrated, let me explain one point. When you compile the project in debug, you will get an error that Installer.exe is missing. You can either change the path in the resource file to point to the debug version of Installer.exe, or build in Release first. This will create the file and you won't get the error message. I'm sure that there's a better way to do this, but I'm not aware of it. If you know how to do this, let me know and I'll fix up the project.

Nothing fancy really - in fact, pretty much quick and dirty. The project started out as a Lego project, and I just kept massaging it (with dirty hands) till I got the results that I was looking for.

I was not too consistent (well, actually pretty sloppy) concerning Unicode-friendly code. I'll try to clean this up in the next iteration. (Yeah, you're right - I didn't even attempt to clean this up for version 2. Sorry.)

Development was done under VS7. I don't really plan on porting this to VS6 since I just don't have the time. I don't see any reason why it shouldn't work under VS6. I'd be glad to incorporate the changes if anyone wants to do the port.

MFC is statically linked. The first time that I used it, someone complained about "a missing DLL". Now, why didn't I see that coming? Anyhow, statically linking MFC makes the final installer slightly larger, but avoids hassles and headaches. If you can live with dynamically linked, then go ahead.


No betas, pre-releases, or release candidates. Just an occasional release as the need or mood arises. I don't have time for version control or complicated test procedures. In fact, I barely have enough time for personal hygiene.

  • Version 2.4 - (13 September 2006) - Added Vista as one of the Windows version options. Fixed a bug in the license and info routines where the allocated memory block was one byte short to not allow for the delimiter. Fixed a bug with creating an installer that already exists. I think there are a couple other bug fixes but I can't remember what (I don't keep very good records).
  • Version 2.3 - (never released - too lazy).
  • Version 2.2 - (20 February 2005) - Bummer, another month, another update :-) Seems like Easy Installer has taken on a life of its own. I was again able to find a pre-existing piece of "Lego" (by Arlen Albert) to help me out. His routine MakeSurePathExists() is a replacement for the routine MakeSureDirectoryPathExists() which only exists in Win2K/XP. Thanks to Testeer and Jean-Luc for pointing out this problem. Easy Installer should now work under Win9x/NT.
  • Version 2.1 - (20 January 2005) - License and info files weren't properly added to the installer. This feature now saves the files in the target directory during installation.
  • Version 2.0 - (22 December 2004) - Target installer is now a Wizard; license and info pages were added.
  • Version 1.0 - (15 November 2004) - Initial release.

This time I got some respite before creating a new version - mostly since I never had time to read the comments on CP so I never get around to making any changes. I finally needed to make some changes, and a new version is the result. Suggestions are welcome, but will just end up as a lost Post-It note somewhere in the clutter on my desk. Take care.


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


About the Author

Abu Mami
Israel Israel
lichen farmer, semi-lingual, never saw a Sylvester Stallone movie

Comments and Discussions

GeneralRe: Great work Pin
Abu Mami23-Jun-05 9:01
MemberAbu Mami23-Jun-05 9:01 
Generalanother month, another update Pin
.dan.g.22-Feb-05 12:09
professional.dan.g.22-Feb-05 12:09 
GeneralRe: another month, another update Pin
Abu Mami23-Feb-05 6:38
MemberAbu Mami23-Feb-05 6:38 
GeneralAdd Uninstall feature also Pin
Ahamad Alisha16-Feb-05 3:15
MemberAhamad Alisha16-Feb-05 3:15 
GeneralRe: Add Uninstall feature also Pin
Abu Mami16-Feb-05 9:38
MemberAbu Mami16-Feb-05 9:38 
GeneralAvoiding WinExec Pin
Phil Gilmore4-Feb-05 6:57
sussPhil Gilmore4-Feb-05 6:57 
GeneralRe: Avoiding WinExec Pin
Abu Mami5-Feb-05 5:59
MemberAbu Mami5-Feb-05 5:59 
GeneralRe: Avoiding WinExec Pin
Eric Lapouge22-Feb-05 5:25
MemberEric Lapouge22-Feb-05 5:25 
For registering an ActiveX Microsoft released the source code of regsvr32 in an old PlatformSDK. So with a bit luck you can find it on the Net.

Beside this, if you search on CodeProject, you'll find (for example)[^] wich will give you what you want (and more).

Beside this small point, it's an interesting project!

Eric Lapouge
GeneralRe: Avoiding WinExec Pin
Abu Mami22-Feb-05 8:16
MemberAbu Mami22-Feb-05 8:16 
GeneralMake it work in W95/W98/NT Pin
Member 147594927-Jan-05 22:11
MemberMember 147594927-Jan-05 22:11 
GeneralRe: Make it work in W95/W98/NT Pin
Abu Mami29-Jan-05 6:58
MemberAbu Mami29-Jan-05 6:58 
GeneralMFC mising error Pin
CoderSoup6-Dec-04 7:38
MemberCoderSoup6-Dec-04 7:38 
GeneralRe: MFC mising error Pin
Abu Mami9-Dec-04 8:30
MemberAbu Mami9-Dec-04 8:30 
GeneralRe: MFC mising error Pin
southpawjoe30-Dec-04 7:13
Membersouthpawjoe30-Dec-04 7:13 
GeneralFreeware Installers Pin
Douglas R. Keesler26-Nov-04 19:13
MemberDouglas R. Keesler26-Nov-04 19:13 
GeneralRe: Freeware Installers Pin
Abu Mami29-Nov-04 7:25
MemberAbu Mami29-Nov-04 7:25 
GeneralRe: Freeware Installers Pin
Nir Levy5-Dec-04 5:50
MemberNir Levy5-Dec-04 5:50 
GeneralRe: Freeware Installers Pin
Abu Mami9-Dec-04 8:39
MemberAbu Mami9-Dec-04 8:39 
GeneralRe: Freeware Installers Pin
Simon Hughes28-Feb-05 11:27
MemberSimon Hughes28-Feb-05 11:27 
GeneralSimple Clean and Nice Pin
Alpha Siera23-Nov-04 19:58
MemberAlpha Siera23-Nov-04 19:58 
GeneralRe: Simple Clean and Nice Pin
Abu Mami24-Nov-04 6:36
MemberAbu Mami24-Nov-04 6:36 
GeneralBug fix has been submitted Pin
Abu Mami20-Nov-04 9:20
MemberAbu Mami20-Nov-04 9:20 
GeneralRe: Bug fix has been submitted Pin
revram16-Aug-06 20:41
Memberrevram16-Aug-06 20:41 
GeneralThanks Pin
Ravi Bhavnani20-Nov-04 6:16
professionalRavi Bhavnani20-Nov-04 6:16 
GeneralRe: Thanks Pin
Abu Mami20-Nov-04 6:43
MemberAbu Mami20-Nov-04 6:43 

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.