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:
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
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.
Figure 14.10 Select Win32 Release on the Build toolbar prior to creating a release build
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.
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.
Figure 14.11 Summary page of the InstallShield Wizard
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.
You will also need to package the data link file used by the StloadData.dll to conncect to the database.
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.
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.
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.