1. Technology

Using the Package and Deployment Wizard (VB6)

Use the Packaging and Deployment Wizard to Create Files and Folders

By

Question: How do I use the Packaging and Deployment Wizard to create files and folders when the user installs my application?

VB6 programmers on a budget use the Microsoft Packaging and Deployment Wizard (PDW) to provide Setup systems for their customers. (Programmers with unlimited funds use a commercial package such as InstallShield. VB.NET programmers often use the Microsoft® Windows® Installer (MSI) system.)

--------
Click Here to display the illustration
Click the Back button on your browser to return
--------

An installer is a complex system with the capability to perform a complete deployment. Learning the parameters and options to do use the tool effectively can be a real job!

The PDW will do standard installations - that is, create and distribute your application's setup1.exe program - by simply accepting the defaults as you go through the wizard. To add more files in particular locations, the easiest and best way to go about it is to simply "Add" the files ...

--------
Click Here to display the illustration
Click the Back button on your browser to return
--------

And then specify the location using four "Next" buttons further on.

--------
Click Here to display the illustration
Click the Back button on your browser to return
--------

But if you want something special, you can do it by modifying the Setup Toolkit project.

The Setup Toolkit is a project and a other files installed with VB 6 in the \Wizards\PDWizard\Setup1 subdirectory of the main Visual Basic directory. Be careful when using these files! They're also used by PDW itself and you can mess up your installation by modifying the files directly. Don't change anything without making a backup copy in another directory first. Be aware that if you change setup1.exe, programs created by the Package and Deployment Wizard will use the new version.

Although the Setup Toolkit can be used to create completely new installations, you can usually get the job done by customizing the Setup project in the Setup Toolkit directory and then using the PDW create and deploy the an installation package.

The VB 6 documentation notes that, "There are two setup programs involved in the installation process — 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. Only setup1.exe is customizable through the Setup Toolkit."

One way to use the Setup Toolkit to install your own files is by loading the Setup1.vbp file into Visual Basic and changing it so that additional files are installed.

The VB 6 documentation lists these steps:

1 - In the Setup1.vbp project, edit the code for the Form_Load event in the setup1.frm form. To add functionality, you add code after the code block calls the ShowBeginForm function (Sub ShowBeginForm).

The following shows an example of how you would add a dialog box that asks if the user wants to install optional files:

Dim LoadHelp As Integer
LoadHelp = MsgBox ("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

2 - Close Setup1.frm, save the form and the Setup Toolkit project, and compile to create the Setup1.exe file.

3 - Run the Package and Deployment Wizard, and select Package from the main screen.

4 - Proceed through the wizard, making the appropriate choices. For the example shown above, you would make sure that all optional files the user could choose to install in your custom dialog box were listed in the Add and Remove screen.

5 - Once you are done with the Package and Deployment Wizard, generate the distribution media. 6 - Make any necessary changes to the Setup.lst file. In the example above, you would add a new section with a section you used in the CopySection section of your code. In this case, your section would look something like this:<br><br>

[Help]
File1=MyApp.HL1,MyApp.HLP,$(AppPath),,,10/12/96,2946967,0.0.0

About Visual Basic Guide Note: The Bootstrap Files and Setup1 Files sections of the Setup.lst file contain a complete list of the files that the setup programs (setup.exe and setup1.exe) need to install on the user's computer. Each file is listed individually, on its own line, and must use the following format:

Filex=file,install,path,register,shared,date,size[,version]

You can see more documentation on this at this Microsoft page.

7 - Deploy and test your package.

  1. About.com
  2. Technology
  3. Visual Basic
  4. Quick Tips
  5. Visual Basic 6 FAQ - Pack and Deploy Setup Wizard

©2014 About.com. All rights reserved.