The Setup Toolkit

Steve White
Microsoft Corporation

Revision Date: January 1999

For the latest information, see www.microsoft.com/officedev/default.htm.

The Microsoft® Office 2000 Developer Package and Deployment Wizard uses two setup programs to install your application files onto the user's computer — Setup.exe and Setup1.exe. The Setup.exe program performs pre-installation processing on the user's computer, including installing the Setup1.exe program and any other files needed for the main installation program to run. Setup1.exe contains the forms and code used during installation and can be customized using the Setup Toolkit.

You can use the Setup Toolkit to modify the Setup1 project, in order to customize the functionality or appearance of the Package and Deployment Wizard or to create a custom setup program that does not use the Package and Deployment wizard. Depending on the changes you make to Setup1, you may need to add code to manually perform the steps the Package and Deployment Wizard would otherwise do for you.

Note   To modify the Setup1 project, you need Microsoft Visual Basic® 6.0 installed on your development machine. The Setup1 source code is written in, and must be compiled with, Visual Basic 6.0.

Modifying the Setup Project

You can modify the Setup1.vbp project if you want to add new screens, prompts, or events to the installation sequence created by the Package and Deployment Wizard. You write code in the setup program just as you would in any other Visual Basic program. A number of function calls are available that are especially useful in setup routines.

Some examples of situations in which you might modify the Setup Toolkit project include:

To Modify the Setup Toolkit Project

  1. Create a backup of all the Setup1 files before making any changes. Also make a backup of your existing copy of Setup1.exe, which should be in the ODETools\V9\Wizards\PDWizard folder in the Microsoft Office folder on your computer.

  2. Open the Setup1.vbp project from the ODETools\V9\Sampels\Unsupprt\Setup1 folder.

  3. Make any desired changes to the code, forms, or modules in this project.

  4. Save the project, and compile it to create Setup1.exe.

  5. Copy the new Setup1.exe into the ODETools\V9\Wizards\PDWizard folder.

  6. If you are using the Package and Deployment Wizard to package your application, launch the Package and Deployment Wizard, and create a package for your application. More information is included in the next section, "Customizing the Package and Deployment Wizard".

    If you are creating your own custom setup package, continue through the steps outlined in "Creating a Custom Setup Program" below.

Customizing the Package and Deployment Wizard

If you want only to customize the installation sequence that the user must follow, you can simplify your work by using the Package and Deployment Wizard's existing functionality together with a customized Setup Toolkit project (Setup1.vbp).

Note   Of the two setup programs, Setup.exe and Setup1.exe, only Setup1.exe can be customized.

To Modify Setup1.exe

  1. Modify the Setup Toolkit project to contain any new prompts, screens, functions, code, or other information you want to include. For more details, see the section on "Modifying the Setup Project" in this paper.

  2. When you are finished with the modifications, compile the project to create Setup1.exe.

  3. Run the Package and Deployment Wizard, following the prompts on each screen, to create your distribution media.

Providing Installation Options to the User

You can use the Setup Toolkit and the Package and Deployment Wizard together to add dialog boxes to the installation program, prompting the user to specify whether to install optional features in your application. For example, you may have an online Help file that some users would rather not install. You can add as many installation options as you want.

To Add an Installation Option to Your Setup Program

  1. Edit the Setup1.frm code by adding code like the following in the Form_Load event, immediately after the code block calls the ShowBegin Form function.
Dim LoadHelp As Integer
LoadHelp = MsgBox ("Do you want to install Help?", vbYesNo)
If LoadHelp = vbYes Then
    CalcDiskSpace "Help"
EndIf
.
.
    ' Block of code containing cIcons = CountIcons(strINI FILES)
If LoadHelp = vbYes Then
    cIcons = CountIcons("Help")
EndIf

    ' Block of code containing CopySection strINI_FILES.
.
If LoadHelp = vbYes Then
    CopySection "Help"
EndIf
.
    ' Block of code containing CreateIcons _
strINI FILES, strGroupName
  1. Close Setup1.frm, save the form and the project, and create an .exe file.

  2. Run the Package and Deployment Wizard. At the File Summary screen, after you have confirmed all the file dependencies, add the names of all the files you want to install if the user answers Yes to this dialog box.

  3. Once you are done with the Package and Deployment Wizard, generate the distribution media.

  4. Insert Disk1 into a drive (if you are using a diskette-based installation), and open the Setup.lst File.

  5. Cut and paste the optional file(s) from the [Files] section to a new section. This new section should be below the [Files] section and should have a new section title that corresponds to the string argument (for instance, [Help]) that you used in the CopySection statement. Be sure to renumber the copied lines.
[Help]
File1=5,SPLIT,MyApp.HL1,MyApp.HLP,$(AppPath),,,10/12/96,2946967
File2=6,SPLIT,MyApp.HL2,MyApp.HLP
File3=7,,MyApp.HL3,MyApp.HLP

In this example, when the user runs the installation program, the Setup program copies all the [BootStrap] files to the user's machine, and then prompts the user to indicate whether to install the Help files. If the user chooses Yes, the CalcDiskSpace statement determines whether there is sufficient disk space on the user's machine for the Help files. The program then installs all of the files listed with the [Files] section in Setup.lst.

Next, the program tests the LoadHelp flag again. If the user chose to install the Help files, Setup1.exe then executes the CopySection statement for the Help files, and installs the files listed in the [Help] section of Setup.lst.

Creating a Custom Setup Program

You can use the Setup Toolkit to create a new setup program that does not use the Package and Deployment Wizard. In this case, you will need to add the necessary functionality normally handled by the Package and Deployment Wizard directly to your setup program.

To Manually Create a Custom Setup Program

  1. If necessary, modify the Setup Toolkit project to contain any new prompts, screens, functions, code, or other information you want to include. For more information, see the section on "Modifying the Setup Project" in this paper.

  2. Determine the files you want to distribute, including all run-time, setup, and dependency files.

  3. Determine where to install the files on the users' computers.

  4. Manually create your Setup.lst file to reflect the names and installation locations of all files that must be included for your project.

  5. Determine how you will be distributing files.

  6. Create the .cab files for your project using the Makecab.exe utility.

    Tip   You can use the Package and Deployment Wizard to create your .cab files, then modify the .cab files manually. When the wizard creates your .cab files, it creates a .ddf file and a batch file in the \Support subdirectory of your project directory. To modify the .cab files, edit the .ddf file, then run the batch file provided. The batch file in turn will run Makecab.exe to recreate your .cab files.

  7. Create the Setup1.exe for your project by compiling the Setup Toolkit project with your changes.

  8. Copy your files to the distribution media, or manually publish your files to the Web site using the Web Publishing Wizard, available in the ActiveX® SDK.