Creating a Setup and an Uninstall Program
Your Windows 95 application must be accompanied by a setup program having a graphical user interface. This program must be named SETUP.EXE so it can be identified by the Add/Remove Programs applet in the Control Panel. Your application must also add entries to the system registry specifying the command needed to uninstall your application. Again, this allows your uninstall program to be identified by the Add/Remove Programs applet.
A complete discussion of what’s involved in writing your own setup and uninstall programs is beyond the scope of this article. For information on the requirements for setup and uninstall programs, see the article "Windows 95 Application Setup Guidelines for ISVs" on the MSDN Library CD.
However, as a shortcut for developing setup and uninstall programs, Visual C++ includes the SDK Edition of Stirling Software’s InstallSHIELD. Using this toolkit, you can write a script that specifies the steps you want performed during installation; the InstallSHIELD SETUP application uses this script to install your product. The DRAWCLI sample includes a setup script for use with InstallSHIELD.
The script for DRAWCLI’s setup program installs the executable file for DRAWCLI, the DLLs needed by DRAWCLI, a help file, and some sample files. You can use the script as a basis for creating your own setup program using InstallSHIELD.
At a minimum, the changes you need to make to the script are as follows:
Change the size requirements to reflect the sizes of your program files, help files, and sample files.
Change the application name.
Change the version number.
Change the company name. (This must be consistent with the one you specify in your call to CWinApp::SetRegistryKey).
Change the command lines for the program group items.
Change the filetype extension. (This must be consistent with the extension you specified in AppWizard; this is used by CWinApp::RegisterShellFileTypes).
Change the filetype name. (This must be consistent with the one generated by AppWizard for CDocTemplate::regFileTypeId; this is used by CWinApp::RegisterShellFileTypes).
Other changes may be necessary, depending on the details of the installation process for your application.
With InstallSHIELD, you don’t have to write a separate script for uninstallation. InstallSHIELD’s uninstall program, UNINST, uses a log file that is created automatically during the setup process. This log file enables UNINST to reverse the steps performed during setup.
For more information on using InstallSHIELD, see the InstallSHIELD User’s Guide. For more information on using the system registry, see "Integrating with the System" on the MSDN Library CD.
For a list of the files that you can redistribute with your application, see Redistributable Files in DLL Topics or the file Redistrb.wri in the \OS\System directory on the Visual C++ CD-ROM.