Microsoft KB Archive/151818

= How To Build a Setup Program Creating Multiple Groups/Icon =

Article ID: 151818

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q151818



SUMMARY
By default, the Visual Basic 4.0 Setup Wizard creates one program group using the project name, and one icon within the program group for the executable file generated by the project. This article shows how to create additional program groups and more than one icon within a group for any additional executable files you want to ship by customizing the Visual Basic Setup Toolkit's SETUP1.VBP project.



MORE INFORMATION
The SETUP1.VBP project in the Visual Basic 4.0 Setup Toolkit has two functions defined in the SETUP1.BAS file, CreateOSProgramGroup and CreateOSLink, that allow you to add program groups and icons. By default, the Form_Load event of SETUP1.FRM calls these two functions to create only one program group and one program icon. More program groups and icons can be added by calling these two functions multiple times and specifying new group names and additional executable file names. After you rebuild the SETUP1.EXE file, the modified version will be used in subsequent Setup programs created by the Visual Basic Setup Wizard. The SETUP1.VBP project is located in \SETUPKIT\SETUP1 subdirectory of the main Visual Basic directory.

NOTE: Customizing SETUP1.EXE will make it unusable for other projects.

Step-by-Step Example
 Backup all files in \SETUPKIT\SETUP1 subdirectory of the main Visual Basic directory. This directory is also mirrored on the product CD-ROM in the VB\SETUPKIT\SETUP1 directory. Load SETUP1.VBP, and locate the Form_Load event of the SETUP1.FRM.  In Form_Load event, look for the section with the following comments: '     'Create program groups and icons (or links, i.e. shortcuts) '

  Find the lines where CreateOSProgramGroup and CreateOSLink are called: CreateOSProgramGroup frmSetup1, strGroupName, strGrpPath CreateOSLink frmSetup1, gsDest.strAppDir & gstrAppExe, "", _ gstrAppName

 Comment out those lines.  Before the line: If fCreateGroup Then

set fCreateGroup and fAdditionalIcons to TRUE:

fCreateGroup = TRUE fAdditionalIcons = TRUE

  Suppose this setup program will create one program group called MyGroup1 that contains MyExe1.Exe and MyExe2.Exe, and another group called MyGroup2 that contains MyExe3.Exe and MyExe4.Exe. Suppose that the destination directory for each of the EXE files is $(APPPATH) [ASCII 150] the default. In the places where CreateOSProgramGroup and CreateOSLink are originally called (step 4), type in the following code: CreateOSProgramGroup frmSetup1, "MyGroup1", "MyGroup1.GRP" CreateOSLink frmSetup1, gsDest.strAppDir & "MyExe1.EXE", "",_ "MyExe1", TRUE CreateOSLink frmSetup1, gsDest.strAppDir & "MyExe2.EXE", "",_ "MyExe2", TRUE

CreateOSProgramGroup frmSetup1, "MyGroup2", "MyGroup2.GRP" CreateOSLink frmSetup1, gsDest.strAppDir & "MyExe3.EXE", "",_ "MyExe3", TRUE CreateOSLink frmSetup1, gsDest.strAppDir & "MyExe4.EXE", "",_ "MyExe4", TRUE

</li></ol>

NOTE: Under Windows NT, a program remover icon is created at the last program group. For this example, the icon will be at MyGroup2.


 * 1) Build SETUP1.EXE.
 * 2) Use Setup Wizard to build the setup program. This setup program will create two program groups, and each program group will contain two EXE files.
 * 3) Restore the original SETUP1.VBP files to the \SETUPKIT\SETUP1 subdirectory of your main Visual Basic directory.

Keywords: kbhowto KB151818

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.