Lab 14: Packaging and Deploying the STUpload Application

This lab finishes the STUpload project, bundling it into an installation program named Setup. When executed on the client's system, the Setup program decompresses data stored in a .cab file, copies STUpload's executable files to the hard disk, and registers the application's components. In this lab, you will:

  • Create a release version of STUpload.
  • Create an InstallShield project for the installation program.
  • Add dependencies to the installation project.
  • Build and test a Setup program and .cab files.

The exercises assume that the customer, StockWatch Data Services Inc., maintains a large network connecting members of its staff. The deployed package will therefore be copied to the network, allowing users to run the Setup program and install STUpload on their individual computers.

As mentioned in Lesson 2 of this chapter, the Learning and Standard Editions of Visual C++ do not include the InstallShield tool, but you can purchase the tool separately. If you do not have access to InstallShield, you should still follow along with the text, but you will not be able to complete Exercises 2 through 4.

Estimated lesson time: 15 minutes

Building a Release Version of STUpload

Now that STUpload has been debugged and thoroughly tested, you are ready to create a release version of the program. The release version is smaller and faster than the debug version created in the previous chapter, because the compiler does not add symbol information to the object files, and also because the compiler optimizes the code to reduce its size.

  • To create a release build optimized for size
    1. Open the STUpload project in Visual C++.
    2. On the Build toolbar, select the Win32 Release build context as shown in Figure 14.10.
    3. click to view at full size.

      Figure 14.10 Select Win32 Release on the Build toolbar prior to creating a release build

    4. On the Project menu, click Settings.
    5. In the Project Settings dialog box, click the C/C++ tab and select Minimize Size in the Optimizations box.
    6. Click OK to close the dialog box.
    7. On the Build toolbar, click Build to build a release version of STUpload.

    Creating the InstallShield Project

    Now that you have built a release executable for STUpload, you will create an InstallShield project for the application. The InstallShield project builds the required Setup program that deploys the STUpload application and its auxiliary executable files.

  • To create an InstallShield project for STUpload
    1. With the STUpload project still open in Visual C++, click InstallShield Wizard on the Tools menu.
    2. If the STUpload project is not listed in the wizard's Visual C++ Project box, click Browse and browse to the STUpload.dsw file in the STUpload project folder. Double-click STUpload.dsw to add it to the wizard's Visual C++ Project box.
    3. Click Next to proceed to the wizard's next step.
    4. Check the accuracy of the application information, and then click Next to proceed.
    5. The wizard shows a summary of information gleaned from the STUpload.dsw workspace file. As shown in Figure 14.11, the information includes the names of the two ActiveX controls, msadodc.ocx and msdatgrd.ocx, which were added to the STUpload project in Chapter 7. msadodc is the Microsoft ADO Data Control, and msdatgrd is the Microsoft DataGrid control. The wizard read the controls' class identifiers stored in STUpload.dsw, and then consulted the system registry to find the locations of the .ocx files.

      click to view at full size.

      Figure 14.11 Summary page of the InstallShield Wizard

    6. Click Finish to launch InstallShield, which automatically opens the new STUpload installation project.

    Adding Dependencies to the Project

    STUpload requires the services of another dependency, the STLoadData.dll component added to the project in Chapter 9. STLoadData is not an ActiveX control, but is nevertheless self-registering because it exports the DllRegisterServer() and DllUnregisterServer() functions. The component should therefore be added to a file group for which the Self-Registered flag is set to Yes.

    Such a file group already exists in the project, so it's not necessary to create a new group. To contain the project's ActiveX controls, InstallShield has created the OCXs file group and has set the Self-Registered flag for the group. This exercise adds the STLoadData component to the OCXs file group.

  • To add STLoadData to the OCXs file group
    1. In the InstallShield workspace window, click the File Groups tab and expand the list for the OCXs group.
    2. Right-click the Links entry under OCXs, and then click Insert Files on the shortcut menu.
    3. Browse to the folder containing STLoadData.dll, select the file, and click Open. The list of files in the OCXs group now includes STLoadData.dll.

    You will also need to package the data link file used by the StloadData.dll to conncect to the database.

  • To add Data Links file group and the data link file
    1. On the File Groups tab, right-click the STUpload File Groups item. Add a new file group named Data Links.
    2. Add the \DataLinks\STLink.udl file that you created for the lab in Chapter 10 to the Data Links file group.

    NOTE
    These exercises assume that the Microsoft Data Access Components (MDAC) have been installed on the client machines. For a discussion of the issues surrounding the redistribution of MDAC see the Technical Article "Redistributing Microsoft Data Access Components" in Visual C++ Help.

    Building and Testing the Setup Program

    This exercise invokes InstallShield's Media Build Wizard to create the Setup program. In addition to the Setup file, the resulting installation package includes various information files and a .cab file containing compressed copies of the four executable files that are installed on the client's network. The executable files are STUpload.exe and its components MSAdodc.ocx, MSDatGrd.ocx, and STLoadData.dll.

  • To build the Setup program for STUpload
    1. On InstallShield's Build menu, click Media Build Wizard.
    2. In the Media Build Wizard's first step, type STUpload in the Media Name box, and then click Next.
    3. In the list of media types, select the entry for 1.44-MB 3.5-inch disks. This selection determines how you will send the finished installation package to StockWatch Data Services, which will then copy it to a network share visible to all users.
    4. Click Next four times to move past the Build Type, Tag File, and Platform steps, accepting their default settings.
    5. At the wizard's Summary step, click Finish to build the project.
    6. When the Media Build Wizard finishes, click Finish to terminate the wizard.

    The Disk Images folder in the C:\MyInstallations\STUpload\Media\STUpload subdirectory now contains a folder named Disk1. Disk1 contains all the files required to install the STUpload application on another computer. You need only copy Disk1 to a single 3.5-inch disk and ship the disk to your client.

    To test the installation, place the disk in another computer and run Add/Remove Programs to start the Setup program. If the Setup program asks for a serial number, simply type any text to continue. When you have finished, run the installed STUpload application to make sure all files have been correctly decompressed from the .cab file, and that the three COM components have been correctly registered on the test computer. To remove the program and test the uninstaller, run Add/Remove Programs again and remove STUpload.



    Microsoft Press - Desktop Applications with Microsoft Visual C++ 6. 0. MCSD Training Kit
    Desktop Applications with Microsoft Visual C++ 6.0 MCSD Training Kit
    ISBN: 0735607958
    EAN: 2147483647
    Year: 1999
    Pages: 95

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net