Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Tools

Visual Installation


Visual Tools 96: Visual Installation

Visual Installation

Creating installers without coding

Al Williams

Al is the author of the "20/20" column in Dr. Dobb's Sourcebook. You can contact Al at http://ourworld .compuserve.com/homepages/Al_ Williams.


At one time or another, nearly every programmer has to write an install program. That time usually arrives at the end of product development, when you must ship something in 48 hours, or else. Of course, you can write an installer from scratch. Why not? You already know some programming language, and Windows has at least minimal installation support. Unfortunately, the built-in support for installation is buggy and poorly documented (see my article "Installing Windows 95 Programs," Dr. Dobb's Journal, September 1995).

Most popular installer tools require you to write a script to create your installer. This doesn't seem very productive, especially if you are scrambling around at the last minutewhy learn a new language just to write installers?

Since the current trend in software development is visual tools, it probably comes as no surprise that visual installers are also starting to appear (for more information on some of these tools, see the accompanying text box entitled "Visual Installers"). For the most part, these tools aren't visual in the traditional drag-and-drop fashion. Instead, they allow you to design an installer by filling in dialog boxes. Still, the results can be very effective.

In this article, I'll use one of these toolsSax Software's Setup Wizardin a real-life application. The installer (available electronically; see "Availability," page 3) sets up a ten-minute multimedia training demonstration on using the Windows registry. I developed the presentation without using programming tools, so it was a very attractive idea to develop the installer without programming, either.

Steps to an Installer

Writing an installer with Setup Wizard (or any of the similar installation tools) could hardly be simpler. You start the Wizard, and answer a few questions; see Figure 1. One of the most interesting features of the Wizard is that it will attempt to automatically determine what files you should include in your installation. You can direct it to:

  • Run an executable, observing what files it uses.
  • Run a Delphi project, observing what files it uses.
  • Run a Visual Basic 3.0 project, observing what files it uses.
  • Scan a directory tree, picking up all the files in the tree.

Then you can select various common components that you also want to install (OLE 2.01, VB3 run time, the Borland database engine, and so on). Although this tool has several concessions for Visual Basic and Delphi, you can use it with any set of files or an .EXE you have created with any language.

Once you have finished with the Wizard, you return to the main screen; see Figure 2. There are seven selections on the main screen, and the Wizard fills many of them in for you.

The File Groups selection allows you to define collections of files that the user can select at install time. For example, you might have a file group for stereo-sound support. Then, if you make the group public, the user will check a box to include or exclude the group. If you make the group private, the setup program will only install the group for particular operating systems or CPUs (see Figure 3).

The next selection is the Components item. Here, you select predefined packages (like OLE 2.01) and associate them with certain file groups. You can define your own components, too.

With the Directories selection, specify any subdirectories you want to create. You can set the directory to belong to a particular file group. The setup program creates the directory only if the file group is active.

The Files area specifies what files the installer will copy to the user's hard disk. You can control where the file goes, what group it belongs to, and what to do if the file already exists; or you can specify that the file should be on the first installation disk, if possible. You also can tell the program to compress the file when making setup disks and decompress it when installing.

The next two groups, Billboards and Actions, let you customize the installer. You can design bitmaps that the installer will show during installation (billboards). These are like old-fashioned Burma Shave signsif there are four, you'll see the first one for 1/4 of the setup time, then the second one appears. This continues so that you see each billboard once for the same amount of time during the installation. The Actions item lets you direct the setup program to view a file, run another program, modify an .INI file (or the registry), install a font, or exit Windows (among other things).

The final group of options pertain to Program Manager. Here, you can specify what Program Manager (or Windows 95 shell) groups and icons you want the setup program to create. You can associate different icons with different file groups, of course.

In addition to these groups, there is a dialog under the Tools menu that controls the appearance of the entire project. You can select the default install directory and the colors used in the background, and cause setup to prompt for the user's name and company name.

You often don't need to work with any of these categories, as the Wizard has filled them in for you. Of course, if you want to use Billboards or custom actions, you'll want to put those in the project. Also, you should review (and might need to fine tune) the Wizard's work. Usually, you'll just save the project. This doesn't create a setup program. Instead, it creates a database that records your choices. Later, you'll be able to reload that database and make changes.

To actually create the setup program, you need to start Disk Wizard from the menu or the toolbar. Disk Wizard allows you to select from a wide range of media. You can pick floppy disks from 360 KB to 1.44 MB, CD-ROM installation, or e-mail distribution. The e-mail option creates a single .EXE file that has everything you need to install your project. This is a good option if you plan to place your install disks on the Internet, for example. After you pick your media type, you can instruct Disk Wizard to create directories on your hard disk to represent the media, or actually write to the media. That's it. Once you finish the Disk Wizard, your setup files are ready to go.

Building the Installer

As an example of this process, I created an installer for a demo presentation using the Windows registry. This is a set of slides I might use at a conference presentation, along with files for the audio portion. I didn't write the software. Instead, the presentation requires the run-time version of SST (a presentation package). Although the Sax Setup Wizard leans toward Visual Basic and Delphi programs, you can use it with anything, as this example shows.

I ran the Wizard and filled in the basic information. I let the Wizard scan the directory that holds the presentation and the run-time software. This was an easy project, since I didn't need any file groups or other special setup options.

For a first pass, I decided to try out the setup program without making any changes. I originally told the Wizard I wanted a long title to appear on the setup screen ("A-Train Video Demo (c)1996 by A-Train. All Rights Reserved."). That worked fine, but the setup program also used the entire string in the introductory dialog box (see Figure 4). Obviously that wasn't going to work.

Some other things I noticed about the setup program:

  • The setup program didn't attempt to estimate the size of the installed files versus the free disk spaceat least, not that I could tell. With compressed disks, it is difficult to check this rigorously. Still, you could make some attempt.
  • It didn't include a README.TXT file. After I thought about it, I decided that would be a nice addition.
  • The Wizard didn't create any Program Manager groups for my project.

Changing the Installer

It was easy to go back to the setup editor window and change the title to something more appropriate. I also easily added a README.TXT file using the Files selection. Then I added an action to display the file after installation. I also created two Program Manager icons: one for the presentation, and one for the README.TXT file.

While I was making changes, I decided to alter the background color using the Project Options item on the Tools menu. After running Disk Wizard again, the setup file looked much better (see Figure 5). Of course, I still could not tell the user how much disk space he might need. I suppose you could arrange to display the README.TXT file before the installation and mention the disk-space requirements there. Still, that doesn't seem like an ideal solution.

Other Considerations

This simple project doesn't show off everything about Sax Setup Wizard, but it gives you some idea of how it works. I thought about adding a billboard to make the installation more attractive, but since users will download this program, I wanted to keep it as short as possible.

If you test an executable, there are a few things you should know. First, be sure to exercise as many parts of your program as possible. Your code may only use a certain DLL when it saves files, for example. If you don't save a file while the Setup Wizard is watching, it won't include the DLL in your install list. Be sure to double check the Wizard's work. You can always change the file lists yourself.

If you need to extend the setup program, you can run an external program. Of course, unless you write the external program carefully, it will be clear to the user that you are running another program. Besides, the whole point is to not write any code. A DLL interface might help here. But that, too, means writing code. Of course, you can also use the external-program feature to run your installed program after setup is complete.

The End Result

Creating an installer easily is certainly a worthwhile goal. For simple jobs, the Sax Setup Wizard does an admirable job, but there are a few problems:

  • I didn't like the fact that you had to build the program before you could see how it would look. This problem isn't unique to the Sax product. All of the visual installers I looked at were not very "visual" in the traditional sense.
  • The Sax tool had lots of features, but sacrificed some control (for example, the aforementioned problem with the title string). Other tools (like Eschalon's Setup Pro) had more control, but fewer features.
  • It was unfortunate that the Sax tool had no way of warning users about how big the installed files would be. The Eschalon tool doesn't check for free space, but it does warn you about how much space it expects to use. Sax reports that a new version should be out by the time you read this. Perhaps they will address some of these problems. Still, if the setup program it produces will work for your application, then none of these flaws are fatal. If you want to see the final result, you can find the setup program along with this month's online listings.

I selected Setup Wizard because it was representative of current-generation visual-install tools. No matter which tool you use, it's great to be able to create installers without coding in a script language. Then you can spend more time writing the code to install!

Visual Installers

There are currently four tools that I consider visual installers. While there might be more out there, I think these have some true visual quality about them.

Eschalon's Setup Pro. This tool is similar to the Sax Setup Wizard that I used to build the sample installer. It doesn't support as many features as Sax, but it does offer you greater control. For example, you can set individual titles, or use a bitmap as a background. Setup Pro doesn't scan executable files the way Sax does. But, you can, for example, display a meaningful name in the setup progress dialog instead of the file name. Eschalon also warns the user how much disk space the install will take. In my opinion, Setup Pro isn't clearly better than Setup Wizard, but it isn't clearly worse, either. You can get a free demo version of Setup Pro online.

Jetstream InstallWizard. This tool is different from both the Sax and Eschalon offerings. The InstallWizard works like Setup Pro and Setup Wizard until the end. Instead of creating a database file that contains your choices, InstallWizard creates an MFC C++ program that you compile to generate your installer. While this requires a different degree of sophistication, it is very powerful, since you canin theorymodify the code to do anything you want. Of course, if you don't already use MFC, this is a big drawback. On the other hand, this is a great way for MFC programmers to create installers. While I object to script languages, I don't have a problem with using the exact language that you develop applications in to write an installer.

Sax Setup Wizard. This is the tool I used to create the example installer. The Sax interface is clean and easy to use. It doesn't offer you as much control as the Eschalon tool, but it does have more features (.EXE scanning, registry manipulation, and most of the customizing actions, for instance).

InstallShield Express Professional. This tool provides a very polished interface at design time and run time. The tool supports both CD-ROM and disk installation, as well as a single-file, self-extracting .EXE option for distribution across networks. The tool is extensible, allowing you to call external DLLs or InstallShield scripts. It also creates an uninstaller. Customized subsets of InstallShield Express are shipped with Visual C++ 4.1, Visual Basic 4.1, Borland C++ 5.0, Delphi 2.0, Paradox 7.0, and Optima++ 1.0.

At this writing, Jetstream's Install Wizard and InstallShield Express are available in 32-bit versions. Both Eschalon and Sax have plans for 32-bit versions that may be available by the time you read this.

A.W.

For More Information

Eschalon Setup Pro

Eschalon Development Inc.

24-2979 Panorama Drive

Coquitlam, BC, Canada V3E 2W8

604-945-3198

http://www.eschalon.com

Jetstream InstallWizard

Jetstream Software Inc.

218 Main Street #107

Kirkland, WA 98033

206-827-9273

http://www.jetsoft.com/jetstrm

Sax Setup Wizard

Sax Software

950 Patterson Street

Eugene, OR 97401

503-334-2459

http://www.saxsoft.com

InstallShield Express

InstallShield Corp.

1100 Woodfield Road, Suite 108

Schaumburg, IL 60713

847-240-9111

http://www.installshield.com/express

Figure 1: The Setup Wizard.

Figure 2: The Setup Editor.

Figure 3: The File Group Property Sheets.

Figure 4: The installer (first try).

Figure 5: The completed installer.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.