File Packaging with the Package and Deployment Wizard

You can use the Visual Basic Package and Deployment Wizard to quickly and easily package your ActiveX components for Internet component download. The Package and Deployment Wizard packages your components into a file that the browser can recognize, and creates a Web page from which the user can download the page. You then deploy the resulting materials to a Web server where users can access it.

Note   Before using the Package and Deployment Wizard to package your own ActiveX control for Internet component download, you should become familiar with several important concepts, including component safety and digital signatures.

Files Created by the Package and Deployment Wizard

The Package and Deployment Wizard creates two main sets of files when it packages code for Internet component download: distribution files and support files. Distribution files are located in the directory you specify when you begin the wizard. This directory typically contains the .cab file and any .htm files associated with it.

Note   If you make any changes to the project after you build the .cab file, such as modifying the list of files to include with the download or digitally signing the components, you may need to rebuild the .cab file.

The wizard creates a directory for support files and places the input file (.inf file) for the .cab in this directory. In addition, the support files directory contains the Diamond Directives (.ddf) file, and other files needed for the download.

The following table lists all the file types created by the wizard:

Extension Description
.cab Windows setup file or "cabinet" file that contains the .ocx file, the .inf file and other dependent files. You can digitally sign this file to prevent tampering.
.htm HTML file used to display a Web page. This file contains a link to the .cab file and is used to launch the download process.
.ddf Diamond Directives file. This is the project file for creating the .cab files.
.inf Code download information file. This file includes information on how the control should be installed. It permits customization of installation.
.ocx ActiveX control. You can digitally sign this file to prevent tampering.
.dll ActiveX document or code component.

HTML Created by the Package and Deployment Wizard

The following fragment from an .htm file illustrates what the Package and Deployment Wizard produces in a typical Internet component download.

<HTML>
<!--   If any of the controls on this page require licensing, you must create a license package file.
   Run LPK_TOOL.EXE in the tools directory to create the required LPK file.

<OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
   <PARAM NAME="LPKPath" VALUE="LPKfilename.LPK">
</OBJECT>
-->
<OBJECT
   classid="clsid:F651BF93-239B-11D0-8908-00A0C90395F4"
   id=ShapeLabel
   codebase="ControlDemo.CAB#version=1,0,0,1">
</OBJECT>
</HTML>

Examine the second Object tag in the example above. This tag contains a reference to a control with the ID ShapeLabel. It has a class ID of F651BF93-239B-11D0-8908-00A0C90395F4. Each ActiveX control you create will have a different class ID. The class ID is used to create an instance of the control on the HTML page, similar to the process of placing a control on a Visual Basic form.

Internet Explorer uses the class ID to check the registry to see if the control exists. When it does not exist or when the version number of the control is less than the version specified in the CODEBASE attribute, Internet Explorer downloads and installs the specified file.

The important parts of the Object tag include:

Tag Attributes Description
CLASSID Class identifier, contains the class ID for the component.
ID Name of the component. Used in scripting, this is equivalent to the Name property of a control on a Visual Basic form.
CODEBASE Minimum version number of the control required and the location of an installation point.

For More Information   See "Distributing your Applications" in the Programmer's Guide for instructions on using the Package and Deployment Wizard to package your controls. See http://www.w3c.org for more information about the OBJECT tag and its use. See http://www.microsoft.com/workshop/prog/cab/ for more information on .cab files.