Previous Page TOC Next Page



- 27 -
Making Distribution Diskettes with the Visual Basic Setup Kit


Some Visual Basic 4.0 database applications may call for a one-time-only installation by you, the developer. If that's the case, you can copy the application's .exe, .hlp, and .ocx files, together with any database and ancillary files that may be required, onto a set of diskettes that you copy to the appropriate directories of the client's computer. If your Visual Basic 4.0 database front-end is to be used by a large number of people, or you want to impress your clients with a sophisticated Setup application similar to those used to install mainstream Windows applications, you need to create "official" distribution diskettes.

Visual Basic 4.0 includes an Application SetupWizard and a Setup toolkit to create programs that install the files needed by your database applications. This chapter describes how to use the SetupWizard, how the Setup application created by the wizard appears to recipients of your distribution diskettes, and how to customize the standard Setup application to conform to special requirements of your Visual Basic 4.0 database applications.

Using the SetupWizard to Create Distribution Diskettes


The Visual Basic 4.0 SetupWizard is based on the design of wizards included with Microsoft's Word 7.0, Excel 7.0, and Access 95—a step-by-step guided format that has, by now, become familiar to millions of Microsoft productivity application users worldwide. The Visual Basic 4.0 SetupWizard provides the following benefits:



The Visual Basic SetupWizard makes a single set of distribution diskettes each time you execute it. If you send the SetupWizard's output to a disk directory for network distribution or for later CD-ROM mastering, the SetupWizard places your application's compressed files in a single directory you specify. If you send the SetupWizard's output directly to diskette, the SetupWizard places your application's compressed files in a subdirectory named \SetupWiz of whatever directory your Visual Basic project is stored in. You can create additional diskette sets by saving a SetupWizard template (as described in the "Running SetupWiz.exe" section, later in this chapter), and then later loading the template in SetupWizard to copy the compressed files onto another set of diskettes. Alternatively, if you want to duplicate the Visual Basic diskettes, you can create a \Disk# subdirectory on your hard disk for each of your application's distribution diskettes, and then copy the diskette files to create the image in the appropriate subdirectory.

When an end-user installs your application with the Setup.exe and Setup132.exe programs created by the SetupWizard and all of the application's required files are copied to the appropriate directories, an entry on the Windows 95 Start | Programs menu is automatically created for your application (or a program group and icon in Windows NT) and appropriate entries are made in the Windows Registry database.

The sections that follow describe the steps involved in using the Visual Basic SetupWizard to create distribution diskettes.

Running SetupWiz.exe


Using the SetupWizard is probably the easiest way to create distribution diskettes for your application. This chapter, therefore, concentrates on using the SetupWizard and on how to modify the files that the SetupWizard produces to customize your application's installation. The example shown in this section uses the files for the Drilldown application (Drill_dn.vbp) that are contained in your \Ddg_VB4\32_bit\Chaptr12 folder, plus Graphs.mdb, which is located in your \Ddg_VB4\32_bit\Chaptr11 folder.



Before you start the distribution-diskette production process, make sure you have two or more empty, formatted diskettes ready. Smaller applications that do not use the data-access, report-generation, and graphing features of Visual Basic usually fit on one diskette. (The SetupWizard automatically employs Compress.exe to compress the distribution files.) Two to four diskettes usually are required for Visual Basic 4.0 database applications. The Drill_dn.vbp project used in this example requires four 1.44MB floppy diskettes, for example.

If you elect to send output to a disk directory for network distribution or mastering a CD-ROM disk, create the destination directory ahead of time.


To create distribution diskettes for your Visual Basic 4.0 database application, follow these steps:

  1. Launch SetupWiz.exe by choosing the Windows 95 Start | Programs | Visual Basic 4 | Application Setup Wizard menu command. SetupWiz.exe is located in your \VB4\setupkit folder; the SetupWizard's required initialization file, Swdepend.ini, is located in your \Windows folder. (Swdepend.ini contains information about Visual Basic's runtime dependencies, and the dependencies of .ocx, .dll, and other component files.) The first SetupWizard dialog appears as shown in Figure 27.1. The Open Template/Save Template button is discussed in conjunction with the last step of this procedure. You can obtain help during each step of the process by clicking the Help button, or you can terminate the wizard by clicking the Exit button. You use the Next button to proceed and the Back button to redo the preceding step throughout this procedure.

    Figure 27.1. The opening form of the Visual Basic SetupWizard.

  2. Enter the full path to and the name of the .vbp file for your application in the Project File text box, or click the ellipsis button (. . .) at the right of the Project File text box to display the Open dialog ("Locate VB application's .VBP file"), as shown in Figure 27.2.



    If you have not compiled your application to an .exe or .dll file, or the .exe or .dll file for your application is in another directory, the wizard creates the file for you. If you tick the check box titled Rebuild the project's EXE file, the wizard will do so at this point.

    Figure 27.2. Using the Open dialog to specify the location of the .vbp file.

  3. The wizard determines the files that are required for your application from the project's .vbp file, as well as from the code and control objects in your .bas and .frm files. (Unlike previous versions, Visual Basic 4.0 saves all of its .bas and .frm files in text format, so the SetupWizard no longer has a problem reading .bas and .frm files in binary format.) If your project contains references to dependent objects—such as an object library reference to Access 95 or Excel 7.0—and the SetupWizard can't find information about the dependent object in the Swdepend.ini file, then the dialogs shown in Figure 27.3 and Figure 27.4 appear. First, SetupWizard asks if the file refers to a remote OLE server. If you click the Yes button, the SetupWizard asks you for the appropriate remote server information. Otherwise, SetupWizard displays the dialog shown in Figure 27.4, informing you that you need to add information about the OLE server in step 4 of the wizard.

Figure 27.3. The first message dialog that appears when SetupWizard can't find dependency information for a referenced object library.

Figure 27.4. The dialog that informs you of the necessity to manually add the OLE server file in step 4 of the wizard.



You can only use remote OLE automation servers if you have the Visual Basic 4.0 Enterprise Edition. For Visual Basic Professional and Standard editions, you may only include local OLE servers in your application.

  1. 4. If your application has a reference to DAO, the second SetupWizard dialog now appears. (If your application does not have a reference to DAO, the SetupWizard skips this step.) Tick the check boxes to add the data access engines that are required by your application, as shown in Figure 27.5. (The Drilldown application does not require any additional data access engines.)

    Figure 27.5. Choosing the data access engines to be installed with your application.



    The SetupWizard automatically installs the Jet 3.0 database engine, along with any database engines directly referenced in your code. You only need to choose additional database engines if your application permits the user to make open-ended choices about what databases the application will open. Contrary to the notes in the Visual Basic documentation and in the Step 2 dialog of the SetupWizard, you don't need to create an additional set of setup disks if you include ODBC drivers. The wizard checks your Registry database to determine which ISAM and ODBC database engines you have installed on your computer.

  2. You can create 5.25-inch or 3.5-inch distribution diskettes in double- or high-density formats with the SetupWizard. Figure 27.6 shows the third wizard dialog, which enables you to select the drive and density of your distribution diskettes. Alternatively, you may choose to direct the SetupWizard's output to a directory on your hard disk in order to distribute your application over a network, or to supply a source directory for mastering a CD-ROM disk.

    Figure 27.6. Choosing the drive and density for diskette production, or selecting a directory for output.

  3. The fourth SetupWizard dialog, shown in Figure 27.7, gives you the opportunity to add any OLE servers to be distributed with your application. If you received the message dialog shown in Figure 27.4, you should add the OLE server now. Click the Add OLE Server button to display a standard Open dialog, and select the server file(s) you want. Before adding the file you select, SetupWizard checks to ensure that the file you specified is capable of registering itself, or that SetupWizard can discern enough about the server to determine how it should be registered. If SetupWizard cannot determine how a file should be registered, it displays an error message. If you're certain you selected the correct server file, and you receive the message that SetupWizard can't determine how the file should be registered, then you may need to modify the source code for Setup1.bas (found in your \VB4\setupkit folder) to manually add the instructions required to register the OLE server.

    Figure 27.7. The SetupWizard enables you to add OLE servers for distribution with your application.

  4. After completing step 4, the SetupWizard displays the fifth step, shown in Figure 27.8, listing all the dependent application files that SetupWizard has found and will include with your application. You can delete any files you know aren't required. Step 7 of the wizard gives you an opportunity to add any files that the wizard somehow missed.

    Figure 27.8. The wizard's dialog that lists the dependent files to be included on the diskettes.

  5. In step 6 (shown in Figure 27.9), the wizard prompts you to select the deployment model for your application. If your application is an end-user application, choose the Install in application directory option. If your application is an OLE Automation server component, select the Install as OLE automation shared component option.

    Figure 27.9. Choosing the deployment mode for your application.



    The SetupWizard is not omniscient; it is not able to determine if database file(s), help files, ReadMe.txt, or other ancillary files are required by your application. You must add all such required files in step 7 of the wizard.

  6. The step 7 dialog of the SetupWizard provides you with a last opportunity to remove unneeded files from the distribution list, or to add any needed files that the wizard was unable to locate by itself. (See Figure 27.10.) To add any database, help files, or other files required by your application, click the Add files button that appears in Figure 27.10 to display a standard Open dialog. The Drilldown application uses the Graphs.mdb database that is located in the \Ddg_VB4\32_bit\Chaptr10 directory.



    Use the Dependency Of text box to determine whether you can safely remove a selected file in the list. If a file in the list is a dependency of more than one object in the project, the Dependency Of text box changes to a drop-down list, as shown in Figure 27.10.

    Figure 27.10. Step 7 of the wizard enables you to fine-tune the list of distribution files.

  7. Once you've added all the files that are required by your application, you can determine the maximum amount of disk space that is required to install your application by clicking the Summary Info button shown in Figure 27.10. The File Summary dialog, illustrated by Figure 27.11, specifies the number of program files and the total size of the program files that will be expanded onto the recipient's fixed disk. (The setup files are used during the installation process only.)

    Figure 27.11. The File Summary dialog, which specifies the number and size of the files to be installed.

  8. If you wish, you may also check or alter specific file details in step 7 of the wizard. Click the File Details button to display a dialog similar to the one shown in Figure 27.12. Use the Destination Directory combination box to either select a predefined destination macro or to enter a specific directory in which you want a component installed. Select the Install as a shared file check box if you want the file count in the Registry to be automatically incremented and decremented. The lower portion of the File Details dialog displays the available information about the file's origin, version number, and so on.

    Figure 27.12. Use the File Details dialog to get information about a component file, to specify that it is shared, or to alter its installation directory.

  9. At this point, the SetupWizard initiates a complex process that includes adding global constants to the Declarations section of Setup1a.frm and adding the code necessary to install the files to the Form_Load event handler of Setup1a.frm. The wizard then creates a temporary directory and generates compressed versions of the files for the distribution diskettes by running Compress.exe (you won't see Compress.exe running—the wizard displays a progress gauge as it compresses files). Once this process is complete, the wizard prompts you for the first blank, formatted diskette (if you're producing diskettes). If you're creating your distribution files in a directory on your hard disk, the SetupWizard is now finished, and the dialog shown in Figure 27.13 is displayed.

  10. After the wizard finishes copying the files to your distribution diskettes, the checkered flag shown in Figure 27.13 tells you that the process is finished. (The Visual Basic 4.0 SetupWizard does not delete its working directory—if you created distribution files on diskettes, the compressed files for your application remain in the \SetupWiz subdirectory of your project's directory.)

    Figure 27.13. The wizard's dialog that informs you that the diskettes and/or distribution files have been prepared.



    You should heed the advice to "scan the distribution disks for viruses." Checking distribution diskettes for viruses saves the embarrassment of being advised by your client that you infected (or attempted to infect) his or her computer. However, the wizard forgets to mention that if you find a virus on the diskettes, you also should scan your fixed disk for viruses immediately.

  11. You can bypass many of the preceding steps by saving a template file that specifies the files that are required by your application. Click the Save Template button that appears in preceding Figure 27.13 to display a standard Save As dialog. Template files have the default extension .vbz. Save the template with the same filename as your .vbp file in the directory in which your application is stored. (Using .vbz files to create distribution diskettes is discussed in the section titled "Using Template Files with the SetupWizard," later in the chapter.) Click the Exit button to close Setupwiz.exe.

The SetupWizard has the capability to create distribution diskettes for the majority of Visual Basic 4.0 database applications. You can modify the template application for the SetupWizard, whose files are specified in Setup1.vbp, to add your firm's or your client's logo to the Setup application.



If you decide to modify any of the template files specified in Setup1.vbp, be sure you make a duplicate copy of the files, either in a different directory or on diskette, before making any changes.


Understanding Swdepend.ini and Setup.lst


The Swdepend.ini file, located in your \Windows directory, is the source of the SetupWizard's information on dependency requirements for various Visual Basic 4.0 application components. The SetupWizard uses the information in the Swdepend.ini file to determine which components will be required for your application at runtime. The Swdepend.ini file contains information about files required for all Visual Basic applications (such as the VB40032.dll runtime library), as well as information about files required to implement specific .ocx controls. The Swdepend.ini file is installed on your computer when you install Visual Basic 4.0 and the SetupWizard. You may wish to modify the Swdepend.ini file to add dependencies for custom controls that you develop yourself or purchase from a third-party vendor. The following is a partial listing of the Swdepend.ini file, showing the dependencies section universal to all Visual Basic 4.0 applications, plus the dependencies section for the Jet 3.0 database engine:




[SetupWiz-32]



Register=



Dest=



Uses1=C:\WINDOWS\SYSTEM\stkit432.dll



SetupProj=D:\Visual Basic 4\setupkit\setup1\setup1.vbp



BootStrap=D:\Visual Basic 4\setupkit\kitfil32\setup.exe



VBExe=D:\Visual Basic 4\vb32.exe



RemoveInstallEXE=D:\Visual Basic 4\setupkit\kitfil32\ST4UNST.EXE



Drive1=1.2 MB Disk,1213952,512



Drive2=1.44 MB Disk,1457664,512



Drive3=720 KB Disk,730112,1024



Drive4=360 KB Disk,362496,1024



Uses2=



CreatedSW=1



[VB Runtime 0409-32]



Register=



Dest=$(WinSysPath)



Uses1=VB40032.DLL



Uses2=ven2232.olb



Uses3=olepro32.dll



Uses4=msvcrt20.dll



Uses5=msvcrt40.dll



Uses6=ctl3d32.dll



Uses7=



[DAO3032.DLL]



Register=$(DLLSelfRegister)



Dest=$(MSDAOPath)



Uses1=MSJT3032.DLL



Uses2=


A full discussion of the syntax of the Swdepend.ini file is beyond the scope of this book. Contrary to the text of Chapter 30, "Distributing Your Applications," of the Visual Basic Programmer's Guide, there is no Swdepend.txt file provided with Visual Basic 4.0. Instead, you can find the full syntax for the Swdepend.ini file in the Visual Basic ReadMe.hlp file; search for the topic "setup toolkit" in the online help system.

Every time you create a new set of distribution files for one of your Visual Basic 4.0 applications, the SetupWizard creates a new Setup.lst file for that application. The Setup.lst file is placed on Disk1 of the distribution diskettes, or into the disk directory you specified for your distribution files. The Setup.lst file is organized into several sections. The [BootStrap] section indicates which files must be copied to the end-user's hard disk for the Setup program to run. When a user installs your application, the Setup.exe program first loads, then reads Setup.lst to determine the required bootstrap files, copies the bootstrap files, and executes the customized Setup132.exe program for your application. The customized Setup132.exe reads the remainder of the Setup.lst file to copy the remaining files onto the user's hard disk and to properly register your application's components.

Using Template Files with the SetupWizard


Template files can save you time when using the SetupWizard to create additional sets of distribution diskettes or to create distribution diskettes with minor changes to the list of files required by your application. The following listing shows the entries that the preceding example creates in the Drill_dn.vbz template file when you click the Save Template button after the SetupWizard has completed making the distribution diskettes:




[SetupWiz]



VBExe=D:\Visual Basic 4\vb32.exe



SetupProj=D:\Visual Basic 4\setupkit\setup1\setup1.vbp



BootStrap=D:\Visual Basic 4\setupkit\kitfil32\setup.exe



RemoveInstallEXE=D:\Visual Basic 4\setupkit\kitfil32\ST4UNST.EXE



CompressToDir=C:\DDG_VB4\32_BIT\Chaptr12\SetupWiz\



[Flags]



AppTitle=Drill_dn



DefaultDir=$(ProgramFiles)\Drill_dn



MakeFilePath=C:\DDG_VB4\32_BIT\Chaptr12\Drill_dn.Vbp,0



Disk Drive=-1



Disk Type=D:\ddg4 tests\



AppExeName=C:\DDG_VB4\32_BIT\Chaptr12\Drill_dn.EXE



Deployment=0



RemoteProvider=0



DataAccess=-1



FilesChanged=0



CheckSum=228546



[Dependencies]



File1=GSWDLL32.DLL,0,32762



File2=C:\WINDOWS\SYSTEM\COMDLG32.OCX,0,32764



File3=C:\WINDOWS\SYSTEM\OLEPRO32.DLL,0,32763



File4=C:\PROGRAM FILES\COMMON FILES\DAO\DAO3032.DLL,0,32763



File5=C:\WINDOWS\SYSTEM\GRID32.OCX,0,32764



File6=C:\WINDOWS\SYSTEM\THREED32.OCX,0,32764



File7=C:\WINDOWS\SYSTEM\GRAPH32.OCX,0,32764



[DB Drivers]



File1=Excel 5.0,Excel 5.0,1,0



File2=Excel 4.0,Excel 4.0,1,0



File3=Excel 3.0,Excel 3.0,1,0



File4=Paradox 3.X,Paradox 3.X,1,0



File5=Paradox 4.X,Paradox 4.X,1,0



File6=Paradox 5.X,Paradox 5.X,1,0



File7=Text,Text,1,0



File8=dBase III,dBase III,1,0



File9=dBase IV,dBase IV,1,0



File10=dBase 5.0,dBase 5.0,1,0



File11=FoxPro 2.0,FoxPro 2.0,1,0



File12=FoxPro 2.5,FoxPro 2.5,1,0



File13=FoxPro 2.6,FoxPro 2.6,1,0



File14=FoxPro 3.0,FoxPro 3.0,1,0



File15=FoxPro DBC,FoxPro DBC,1,0



File16=Lotus WK1,Lotus WK1,1,0



File17=Lotus WK3,Lotus WK3,1,0



File18=Lotus WK4,Lotus WK4,1,0



File19=Jet 2.x,Jet 2.x,0,0



[Files]



File1=C:\WINDOWS\SYSTEM\VB40032.DLL,0,$(WinSysPath),,|32767|,-1,-1,0,0,,,0



File2=C:\WINDOWS\SYSTEM\ven2232.olb,0,$(WinSysPathSysFile),,|32767|10|,-1,0,0,0,,,0



File3=C:\WINDOWS\SYSTEM\olepro32.dll,0,$(WinSysPath),$(DLLSelfRegister),|32767|7|32763|21|22|23|,-1,-1,0,0,,,0



File4=C:\WINDOWS\SYSTEM\msvcrt20.dll,0,$(WinSysPathSysFile),,|32767|,-1,0,0,0,,,0



File5=C:\WINDOWS\SYSTEM\msvcrt40.dll,0,$(WinSysPath),,|32767|7|21|22|23|,-1,-1,0,0,,,0



File6=D:\Visual Basic 4\setupkit\kitfil32\Sys32\ctl3d32.dll,0,$(WinSysPathSysFile),,|32767|,-1,0,0,0,,,0



File7=C:\WINDOWS\SYSTEM\GSWDLL32.DLL,0,$(WinSysPath),,|32762|23|,-1,-1,0,0,,,0



File8=C:\WINDOWS\SYSTEM\COMDLG32.OCX,0,$(WinSysPath),$(DLLSelfRegister),|32764|,-1,-1,0,0,,,0



File9=C:\WINDOWS\SYSTEM\MFC40.DLL,0,$(WinSysPath),$(DLLSelfRegister),|7|21|22|23|,-1,-1,0,0,,,0



File10=C:\PROGRAM FILES\COMMON FILES\DAO\DAO3032.DLL,0,$(MSDAOPath),$(DLLSelfRegister),|32763|,-1,-1,0,0,,,0



File11=C:\WINDOWS\SYSTEM\MSJT3032.DLL,0,$(WinSysPathSysFile),,|9|,-1,0,0,0,,,0



File12=C:\WINDOWS\SYSTEM\MSJTER32.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File13=C:\WINDOWS\SYSTEM\MSJINT32.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File14=C:\WINDOWS\SYSTEM\VBAJET32.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File15=C:\WINDOWS\SYSTEM\VBDB32.DLL,0,$(WinSysPath),,|10|,-1,-1,0,0,,,0



File16=C:\WINDOWS\SYSTEM\MSRD2X32.DLL,0,$(WinSysPathSysFile),$(DLLSelfRegister),|10|32761|,-1,0,0,0,,,0



File17=C:\WINDOWS\SYSTEM\MSWNG300.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File18=C:\WINDOWS\SYSTEM\ODBCJT32.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File19=C:\WINDOWS\SYSTEM\ODBCJI32.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File20=C:\WINDOWS\SYSTEM\ODBCTL32.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File21=C:\WINDOWS\SYSTEM\VBAR2232.DLL,0,$(WinSysPathSysFile),,|10|,-1,0,0,0,,,0



File22=C:\WINDOWS\SYSTEM\GRID32.OCX,0,$(WinSysPath),$(DLLSelfRegister),|32764|,-1,-1,0,0,,,0



File23=C:\WINDOWS\SYSTEM\THREED32.OCX,0,$(WinSysPath),$(DLLSelfRegister),|32764|,-1,-1,0,0,,,0



File24=C:\WINDOWS\SYSTEM\GRAPH32.OCX,0,$(WinSysPath),$(DLLSelfRegister),|32764|,-1,-1,0,0,,,0



File25=C:\WINDOWS\SYSTEM\gsw32.exe,0,$(WinSysPath),,|23|,-1,-1,0,0,,,0



File26=C:\DDG_VB4\32_BIT\Chaptr12\Drill_dn.EXE,0,$(AppPath),$(EXESelfRegister),|32766|,-1,0,0,0,,,0

The [SetupWiz] section of the .vbz file indicates which file to execute to compile the VisualBasic code, where the template for the Setup132.exe program is located, where the Uninstall program files are located, and in which directory the compressed distribution files should be deposited. Next, the [Flags] section contains information such as the application's title, the default installation directory, the name for the compiled executable, and other information about your application. The [Dependencies] section lists the files that provide objects on which your application is dependent—such as the Common Dialog .ocx file. The [DB Drivers] section specifies information about the database engine drivers to be installed with your application, while the [Files] section of the .vbz file specifies the files that are required for use in addition to your Visual Basic .exe file. Additional required files, which are installed in directories other that your application's directory and \Windows\System, are also specified in the [Files] section.

To use an existing template file with the SetupWizard, follow these steps:

  1. Launch the SetupWizard application.

  2. Click the Open Template button to display the Open Template dialog. Select the directory and filename of your template file.

  3. Click the Open button. The SetupWizard loads the template file and presets all its options from that file. You may now either click the Finish button to immediately produce distribution files, or click the Next button to go through each step of the wizard, checking the entries supplied by the template file.


OLE 2.x and OLE Automation Issues


If your application includes OLE custom controls or uses OLE Automation, the Setup application installs all of the necessary OLE server files in the appropriate directories on the recipient's computer. The Setup132.exe program, created by the SetupWizard for your application, will automatically register any OLE components included in your application. For remote automation servers, Setup132.exe executes the Clireg32.exe (Client Registration) utility. Clireg32.exe is automatically included in the Setup.lst file for remote automation applications. (You must have the Visual Basic 4.0 Enterprise Edition to create or use remote automation OLE. Chapter 23, "Creating and Managing Remote Automation Objects," describes remote OLE automation in Visual Basic in more detail.)

How the Setup Application Appears to the Recipient of Your Distribution Diskettes


The operation of Setup.exe and Setup132.exe is similar to other "two-stage" setup applications, such as those used to install Access 95, Word for Windows, or Excel. The following is the sequence of events as seen from the recipient's perspective when installing your Visual Basic database application:

  1. After entering a:\setup or b:\setup in the Open text box of the Run dialog box, the usual Copying setup files. . . message appears for several seconds. Setup.exe reads Setup.lst and attempts to expand the files listed in the [BootStrap] section of Setup.lst (Setup132.exe, and others), and then runs Setup132.exe.

  2. After the initial Setup files are copied, a variation on the standard Microsoft Setup window appears, advising the user to exit any applications that might be running so that shared components may be updated as needed. (See Figure 27.14.)

    Figure 27.14. The opening screen of the Setup application.

  3. After clicking OK to continue, the user sees the dialog shown in Figure 27.15. This dialog states the default directory in which your application will be installed, and enables the user to select a different drive and directory, as desired.

    Figure 27.15. The dialog that Setup displays for the user to select the drive and directory in which to install your application.



    The recipient can enter any directory in which he or she wants to install the application. Thus, you cannot count on the application being installed in C:\Drill_dn. If you hard-coded the installation directory for the database file(s), you have two choices: create the directory and install the database file(s) with code you add to Setup1a.frm and then recompile Setup1a.vbp, or change the code in your application to substitute App.Path for the hard-coded path.

  4. When the recipient clicks the button with the Setup icon to continue installation, the Setup application checks to see if there is enough free space on the selected hard disk for your application's files. If there is not enough space for your application on the user's hard disk, a dialog similar to the one in Figure 27.16 appears. The dialog offers the user the choice of choosing a different disk, attempting to install the application anyway, or ending Setup. If there is enough space, Setup expands the files on diskette 1 to the fixed disk drive. A progress bar shows the percentage completion of the installation. If your application has more than one diskette, a window similar to the one shown in Figure 27.17 appears.

    Figure 27.16. The insufficient space dialog that Setup displays when there isn't enough room for your application's files.

    Figure 27.17. The Setup dialog that appears for diskette 2 and for any additional diskettes.

  5. When all the files have been copied to the destination fixed disk, Setup132.exe creates a new entry on the Windows 95 Start | Programs menu for your application

If you follow the steps in the preceding sections and create four distribution diskettes for the Drilldown application and then install the application with Setup132.exe on your fixed disk, Drill_dn.exe will run only if Graphs.mdb is located in your \Ddg_VB4\32_bit\Chaptr10 directory. The location of Graphs.mdb is hard-coded into the application. Drill_dn.exe can use the copy of Graphs.mdb that Setup132.exe places in the application directory by replacing the hard-coded database file location with App.Path and recompiling Drill_dn.exe. (Alternatively, you could use the File Details button in step 7 of the SetupWizard to alter the destination directory of the Graphs.mdb file.) Using hard-coded directory paths in production programs is not recommended.

Application Removal


In previous versions of Windows, removing applications, or providing a means for users to remove your applications, was often difficult, especially if your application required the installation of shared components such as OLE servers. Visual Basic 4.0's SetupWizard makes it easy to create an Uninstall utility for your applications—in fact, the SetupWizard automatically creates an Uninstall option for all of your applications. (This action is in keeping with the "Designed for Windows 95" logo requirement that each application must provide a means of uninstalling itself and correctly decrementing the count of shared components in use.)

When Setup.exe and Setup132.exe install your application, they create a special file, St4unst.log, in your application's installation directory. This installation log contains a record of all files added to the computer system, and all registry entries created or modified during your application's installation. Setup132.exe also adds your application to the list of installed applications in the Control Panel's Add/Remove Applications applet.

Your application's user may uninstall your application, removing all files and Registry entries that were created or added to the computer during your application's installation. The Add/Remove Applications applet in the Windows 95 control panel reads the St4unst.log file in order to "unwind" the changes that your application installation made.

To remove your application, an end-user follows these steps:

  1. Choose the Windows 95 Start | Settings | Control Panel menu command to start the Control Panel.

  2. Double-click the Add/Remove programs icon in the Control Panel to start the Add/Remove programs applet. The Add/Remove applet displays a tabbed dialog like the one shown in Figure 27.18.

  3. Select the application (Drill_dn, in this case), and click the Add/Remove button. The Application Removal utility displays a blank progress bar and then displays the confirmation dialog shown in Figure 27.19. Click Yes to confirm the application removal.

  4. The Application Removal program displays a progress bar as it deletes your application's files. When deleting shared component files, the Application Removal application displays the dialog shown in Figure 27.20, indicating which shared component is about to be removed, and asking the user whether to keep the file or remove it. This dialog also gives the user the option to specify whether to keep or remove all remaining shared component files.



The dialog shown in Figure 27.20 only appears if the shared component's user count in the Registry has been decremented to 0 by the removal of your application. Properly installed Windows 95 applications (such as Visual Basic 4.0 applications installed with the Setup.exe program created by the SetupWizard) increment the user count of shared components in the Registry whenever the application is installed.

Figure 27.18. The Add/Remove Programs Properties dialog enables users to remove installed applications.

Figure 27.19. The Application Removal utility asks users to confirm the removal of the selected application.

Figure 27.20. The dialog asking a user whether to keep or remove a shared component.



Visual Basic 4.0 applications are removed by executing the St4unst.exe application, which is automatically installed with your application—St4unst.exe is one of the Setup.exe bootstrap files. St4unst.exe is also executed whenever a user cancels your application's installation.


Creating Your Own Setup Application


If you routinely distribute Visual Basic 4.0 database applications that must be customized for individual users, you'll likely need to develop your own Setup application. As an example, database front-ends may need to be customized to take into account the network operating system with which the version is to be used, different methods of communicating with mainframe databases, and/or whether the application is to be run on monochrome laptop computers. For example, if your client uses Information Builder's EDA/SQL, and your front-end application employs EDA/Link for Windows and the EDA/Extender for Microsoft ODBC, you may need to configure different versions of your database applications for conventional coax (IBM 3270 emulation), HLLAPI (High-level link API with Wall Data's Rumba emulator), TCP/IP, or dial-up (asynchronous) communication. Each of these methods for establishing mainframe connectivity require installation of different configuration and operating files on the client computer.

Another reason to create your own Setup application is to automate any required modifications to the client computer's Registry database (and, occasionally, Autoexec.bat and Config.sys files). As an example, EDA/Link for Windows requires that the \EDA directory (or the directory in which the EDA/Link files are installed) be on the DOS path. Many computer users have never even looked at their Registry, Autoexec.bat, or Config.sys files, let alone used a text editor to modify them.

The sections that follow describe the principles you use to modify the Setup application for custom Visual Basic 4.0 installations.

Modifying the Existing Setup Application


As mentioned earlier in this chapter, you can use the files specified by Setup1.vbp as a template to create your own Setup application. The modifications you are most likely to make are as follows:

With the exception of modifying Swdepend.ini, the additional features described in the preceding list can be implemented by minor changes to the code in the Form_Load procedure of Setup1.frm. You can add dialogs to Setup1.vbp so that the recipient can select the type of installation he or she needs. These modifications follow conventional Visual Basic programming practices. To install the additional files or create new program items, copy the code fragments in the Form_Load event-handler and change the arguments of the procedure calls to specify the file you want to add.

Modifying Config.sys and Autoexec.bat Files


Windows 95 is supposed to do away with the myriad of configuration files that Windows 3.1+ users were burdened with. In practice, however, some of these configuration files persist (in particular, the Autoexec.bat and Config.sys files, which have been part of DOS since its beginning). Primarily, these two files remain to support legacy hardware devices that require the loading of real-mode device drivers, and for setting environment variables for the operating system. Typically, you'll only need to examine or modify the contents of a recipient's Autoxec.bat or Config.sys files if your application needs to look at or set specific environment variables (such as the TEMP environment variable, which points to the location of the default temporary working directory for Windows and other applications), or if you need to ensure that your application directory (or the installed directory of an external component) is part of the DOS search path.

You can incorporate Visual Basic binary file instructions and functions in your Setup application to read the Autoexec.bat and Config.sys files on the recipient's fixed disk to determine if you need to make modifications to these files so that your application will execute properly.

Although you can open and write Autoexec.bat and Config.sys with the conventional, line-oriented For Input and For Output qualifiers, using the For Binary qualifier to manipulate the content of these two files with a single string is a safer approach. You parse the string to test for existing entries and then add the required entries to the string. The final step is to write the modified string to the file.



Polite Setup applications advise the recipient with a message box that the Autoexec.bat and Config.sys files may need to be altered. Before making any changes to these files, save a copy of the original versions with the FileCopy instruction and advise the recipient of the names of the backup files. An even more polite approach is to offer the recipient of your application the option of modifying the existing Autoexec.bat and Config.sys files or creating a new set of files that the recipient can inspect before copying over Autoexec.bat and Config.sys.


Summary


Creating distribution diskettes is the final step in developing a Visual Basic 4.0 database application, so it is fitting that this chapter closes Database Developer's Guide with Visual Basic 4.0. The objective of this book is to provide DOS and Windows database developers and Visual Basic 4.0 programmers who are new to database applications with the background needed to create professional-grade database front-ends with the Professional and Enterprise Editions of Visual Basic 4.0. It is hoped that this objective was accomplished.

Visual Basic is reported to be Microsoft's most successful and profitable language product. Therefore, you can expect Microsoft to continue to release upgrades and extensions to Visual Basic. When this edition was written, Microsoft had just announced the development of Visual Basic Script and that it also had licensed Sun Microsystem's Java programming language, both of which are intended for Internet and other network-related programming projects. (Java is an object-oriented programming language designed for programming wide-area and local-area networked applications where the application code is stored on network computers other than the computer executing the application.) Fortunately for Visual Basic developers, Microsoft has given its highest development priority to ensuring that Visual Basic Script will be an effective competitor to Java and JavaScript in the Internet and intranet realms. It's a reasonably sure bet that the combination of Visual Basic and Jet will be the premiere programming system for Internet and intranet servers, and that Visual Basic Script will become the language of choice for creating interactive World Wide Web documents.

The remainder of this book consists of a glossary of terms that might be unfamiliar to readers, appendixes that list sources of add-on products, and additional information for Visual Basic programming. Also included are the standard naming conventions for Visual Basic objects and variables and a detailed index.

Previous Page Page Top TOC Next Page