
Technical Information Database
TI2391C.txt Create your own Install Shield program
Category :General
Platform :All
Product :Borland C++ All
Description:
Using InstallShield Express to Create your own
Installation Program.
This document will review the process of creating
an installation program and disks using InstallShield Express
for Borland C++.
An application isn't complete without a installation program,
but the days of using batch files as install programs are gone.
Windows and applications in general have grown with multiple
files, directories, and configuration settings. Now, besides
installing you have to supply uninstall programs to meet
Microsoft's logo requirements.
You can write your own install program but it's more work than
most realize. Today there is a program that most applications
use to create installation programs today, InstallShield. Borland
C++ v5.0 now includes InstallShield Express (ISX), a special
version of InstallShield that requires no coding. With ISX you
fill in a series of dialog boxes and ISX does the rest.
ISX creates install disks, updates the Windows registry, builds
a uninstall program, and creates folders and icons for your
application. Besides the core installation functionality with
ISX you can add splash screen, billboards, license agreements,
and many other options.
If you require more than ISX offers ISX can be upgraded to
InstallShield Express Pro, InstallShield3 or DemoShield.
Getting Started
===============
To install ISX run the Borland C++ Setup program from the setup
directory. In the Setup dialog click on the InstallShield
Express button. ISX requires approximately four megabytes of disk
space. Once installed run the ISX Quick Tour to get a
feel for look and feel of ISX. The Quick Tour is located in the
ISX Help menu.
Installation Rules of Thumb
===========================
Your installation program should always present your users with
setup options and status. Your installation program should
always supply defaults. It should supply a common response to
every option so all the user has to do is press the ENTER key.
Your installation program should never prompt the user to
install a disk more than once and should make the computer beep
when it is time for the user to insert a new disk.
Your installation program should always include a progress
indicator to show users how far along they are in the setup
procedure.
Installation programs should give the user a chance to cancel
the setup process before it is finished. Your program should
keep a log of files that have been copied and settings that have
been made so that it can clean up a canceled installation. If
the installation is canceled, your program should remove any
registry entries it may have made, remove any shortcuts it may
have added to the desktop, and delete any files it may have
copied onto the user's hard disk.
Installation Basics
===================
Redistributable files
If you create an executable module that uses the dynamic version
of the Borland C++ libraries, you will need to supply one or
more of the Borland C++ redistributable .DLL files with your .EXE
or .DLL. ISX will ensure that your are including the correct
redistributable files. ISX determines the proper .DLL files to
include with your application according to the type of
application you are building.
Removing an Application
Your installation program can direct the Add/Remove Programs
application in Control Panel to list your application as an
application that can be "automatically removed" by adding the
following entries to the registry.
Note: The next lines are broken in two to fit document format.
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
\Uninstall\application-name
DisplayName= product-name UninstallString=full-path-to-program
command-line-parameters
Add/Remove Programs displays the product name specified by the
DisplayName value in its list of applications that can be
removed. Windows uses the value specified by the
UninstallString value to start the uninstall program to carry
out the removal of the application. This string needs to
completely specify the command-line parameters needed to execute
the uninstall program and remove the application. A full path
is required. If both the DisplayName and UninstallString values
are not complete, Add/Remove Programs will not list the
application.
Windows needs to know when the removal of the application is
done, so it requires the UninstallString value to specify the
uninstall program that actually carries out the removal. A
batch file or other program that starts the removal program
should not be specified.
Your installation program should use casual names, including
spaces, for the application-name and DisplayName value. Casual
names help keep the tree comprehensible for users who browse the
registry. The registry locations are defined as constants for C
programmers in the REGSTR.H header file. Descriptions of the
macros follow.
REGSTR_PATH_UNINSTALL Path to uninstall branch
REGSTR_VAL_UNINSTALLER_DISPLAYNAME DisplayName
REGSTR_VAL_UNINSTALLER_COMMANDLINE UninstallString
The uninstall program must display a user interface that informs
the user that the removal process is taking place. It is
recommended that you use the sample uninstall program in the
InstallShield SE Toolkit as the starting point for your own
uninstall program. The sample illustrates the appropriate user
interface and application removal tasks. Your uninstall program
should provide a silent option that allows the user to run it
remotely. The uninstall program should also display clear and
helpful messages for any errors it encounters during the removal
of the application. Windows will only detect and report a failure
to start the uninstall program.
Because computers running Win32s and older versions of Windows NT
do not provide Add/Remove Programs your installation program
needs to include an Icon in the Applications program group so
that the user can launch the uninstall program.
Creating an install program with ISX
====================================
1. When you run ISX it will display a dialog asking if you wish
to create a new Setup Project or open a existing one. We will
create a Setup Project for the BC++ File Finder example. So
click the radio button for Create a new project then the OK
button.
Now you are in the New Project dialog where we input basic
information about our project. First enter "First" as our
Project Name. The default Project Type of Borland C++ is
fine. Next enter "Setup" in the New Subdirectory entry
field. This where ISX will create its files.
There is one last check-box, "Include a custom setup type".
The Custom Setup allows you to select the components of your
application which you wish to install. This is primarily for
large applications like BC++ where there are many types of
files that go into numerous directories. You select the files
to be copied by dragging and dropping them into groups. You
add these groups to components, which represent logical
elements of your application. Using components, you can
offer multiple setup types to your user.
For our small example we do not need a custom setup. Now
click Create and ISX will create the file for your project.
2. "Set the Visual Design" is the first tabbed dialog to fill-in
for our project. On the "App Info" page you enter the
Application name, path to the executable, a version number,
and your company name. For our project enter FFind as the
Application name, leave the default 1.0 for the version, and
"Big Time Software" as the Company name. Then enter the path
to FFIND.EXE in the Application Executable field.
c:\bc5\examples\windows\ffind\ffind.exe.
Now click on the "Main Window" tab. This page gives you the
option of displaying a bitmap or text title on the main
window, including your company logo, its position, and
background color. For our project let us use a text title of
"Welcome to My Setup Program". If you would like to display a
logo click the ellipse button and specify the file to use in
the Open dialog. The default settings for Position and
Background Color are fine,
Now click the last tab "Features". The Features page has
one option for Automatic Uninstaller. The default for this is
yes and it is recommended that you always let ISX create an
uninstaller for you.
3. Next we move to the "Specify Components and Files" tabbed
dialog. The first tab is "Groups" and since we only have one
file only one file for our project all the fields are filled
with the correct default values. We will make one change to
get an idea what this dialog is for.
In the File Groups window click on the plus-sign next to the
Program Files folder. This already has the path and name of
our Ffind executable. Now click the "Launch Explorer" button.
From the Windows 95 Explorer open the folder for the FFIND
example. Highlight the README.TXT file and drag it to the
File Groups window. This is all it takes to add a file to
our project.
Because we are not creating a Custom Setup there are no
settings to make in the Components or Setup Types pages.
Before you create a large setup project be sure to read
"Planning Your Setup" and "Groups, Components, and Setup
Types" in the ISX online help.
4. The next dialog is "Select User Interface Components". Again
our simple project does not require any changes; the defaults
are fine. It is worth looking over all the options
available. They give your application the extra touches
that will impress your users.
5. Next is the "Specify InstallShield Objects for Borland C++"
tabbed dialog. Once again we do not need to make any changes,
but this is an important dialog for your future projects.
This is where you tell ISX which Borland redistribute files
to include.
ISX knows about the various files requires for using RTL
DLLs, VDBT, BWCC, and others. Not only does ISX know which
files it knows what directories they need to be installed in.
It even creates a complete BDE installation program.
6. The next dialog "Make Registry Changes" again needs no
changes. The Windows registry eliminates the need for .INI
files and creates a central database for system and
application configuration information. The Registry is a
whole topic in itself and is beyond the scope of this
document. I recommend using the REGEDIT.EXE utility that comes
with Windows and exploring the Registry and the information
stored within. There are also 3rd party books that explain the
details of the Registry.
The ISX Registry dialog allows you to add keys to the
registry. This dialog is dynamically linked with the
Windows Registry - Values tab, which lets you add/modify the
values of the highlighted key in the Registry - Keys dialog
box. You cannot add to or modify any of the six root keys.
Each key you create must therefore be a subkey of an existing
key.
7. The "Specify Folders and Icons" dialog allows you to specify
the icons you want to place in your application's folder in
Windows 95 or group in Windows NT. On Windows 95 systems, the
folder will be placed on the Start|Programs menu. You can
place an individual icon on the Start|Programs menu using the
Advanced icon settings tab. Once again for our purposes the
defaults will do.
ISX lets you run your application upon exit. This dialog has
an entry field for command line parameter if any are
necessary.
In the Advanced page you can set the Working Directory, icon,
and Short-cut key. The is also a check box to determine if
you want you application added to the Start Menu in adding to
the Programs menu.
8. Well, we are nearing the end. The next dialog is "Disk
Builder". This where all our information is used to create
the images the our distributions disks. The Disk Size drop
down list is where you select the media size you plan to use.
Once the media size is selected click the Build button.
As the Disk Builder begins each task, it will display a
message string in the Feedback window. It will also display
warning and error messages as necessary. The progress bar at
bottom right will indicate the status of the build. The
builder will display a message box letting you know when it is
finished.
If the Disk Builder is unable to locate a file in the
directory specified, a dialog box will give you the option of
launching the Open dialog, which you can use to specify the
location of the file. If you are unable to find the file
using the dialog, you will get an error message. In this
case, find the path specified for the file in the Groups and
Files dialog. You must then either place the file in the
specified location and re-run the Disk Builder, or delete the
file altogether from your setup.
9. Now for the moment of truth. The next item on the checklist,
"Test Run", does exactly that. By clicking on Test Run the
generate project executes so you can see if it is like you
expected. If not you can go back through the dialogs making
changes. Then return to the Disk Builder and then test again.
10. If your Install program works the way you like, you are ready
to create your distribution media. In the last dialog "Copy
To Floppy" you set the drive, path, and insert the proper
size media that you selected in step 8. Once set click the
button labeled "Copy All Disk Images".
That's it, you have now created a full Windows installation
program in a manner of minutes. As you have seen even with the
Express version of InstallShield you can create a very modern
install program with all the bells and whistles of other
applications you have used before. Now that you have created a
basic install program time to go back and experiment with adding
other options.
Reference:
7/2/98 10:40:49 AM
|