Microsoft KB Archive/197988

= How To Deploy an ActiveX Control with the Package and Deployment Wizard (PDW) =

Article ID: 197988

Article Last Modified on 7/15/2004

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q197988



SUMMARY
There are two common ways to distribute an ActiveX control developed in Microsoft Visual Basic:


 * Distribute the control with an application that uses the control.
 * Distribute the control with its own setup package.

This article focuses on how to distribute a control with its own setup package using the Package and Deployment Wizard (PDW).



MORE INFORMATION
The following information provides detailed step-by-step instructions on how to package an ActiveX control created with Visual Basic using the PDW.

The following steps assume that an ActiveX Control project has already been created using Visual Basic.

Step-By-Step Example
 Launch the Package and Deployment Wizard application (PDW). When the PDW appears, the main menu is presented with the following options:

 Select Project Package Deploy Manage Scripts</ul> </li> Select the ActiveX control project (.vbp) to package by typing the path to the .vbp in the Select Project text box, or by browsing to it. If the PDW was started within the Visual Basic IDE while the desired project was open, the correct project is already selected for you.</li> Click the Package button to begin the packaging process.</li> At this time the PDW might present a dialog box similar to the following:

The following source files for this project are newer than the

executable 'D:\Src\Projects\MyControl.Ocx':

D:\Src\Projects\MyControl.Ctl

D:\Src\Projects\MyControl.Vbp

Do you want to recompile? Choose No to use the existing executable.

</li></ol>

NOTE: This message appears if the project was saved again after the control was compiled. If no actual change to the project has been made since the last compile you can ignore this message.

<ol> The next dialog box will be the Package Type. There are three types of packages the PDW can build:

<ul> Standard Setup Package</li> Internet Package</li> Dependency File</li></ul>

Select the Standard Setup Package option and click Next.</li> The next dialog box is the Package Folder. The Package Folder determines where all the files for the package distribution will be located. By default, the PDW wants to create a Package folder in the same directory as the project file. In this example, use the default Package folder by clicking the Next button. A dialog box similar to the following appears:

Cannot find 'D:\Src\Projects\Package' to use as the package folder. Do you want to create it?

Click the Yes button to have the PDW create the Package folder.</li> After selecting the Package folder the PDW asks the following:

If this control will be used within a design environment other than Visual Basic, you will need to distribute the Property Page DLL.

Do you want to include this file in your package?

In this example the control is being packaged for run-time use and not for design time use. Click the No button.</li> The PDW shows the Included Files dialog box. This dialog box lists every file that is currently selected to be included in the distribution package. Note that the Msstkprp.dll file is listed but not selected to be included in the package. This file is only included if the ActiveX control will be used in non Visual Basic design environments (step 8).

With this dialog, extra files can be included with the distribution. For example, ReadMe files or database files can be included at this stage. Use the Add button to browse the computer system and select files to be added to the distribution.

After adding extra files and reviewing the files to be included in the package, click Next.</li> The Cab Options dialog box appears. With a Standard Package there are two options from which to choose:

<ul> Single Cab</li> Multiple Cab</li></ul>

If you choose the Multiple Cab option, a third option becomes available specifying the size of each Cab for the package.

For this example, choose the Single Cab option and click the Next button.</li> The Installation Title dialog box appears. This option determines what is displayed with the setup program when the ActiveX control is being installed as well as what is shown in the Add/Remove feature in the Control Panel. The default is the name of the project being packaged. Click the Next button to accept the default.</li> The Start Menu dialog box appears. This dialog allows the customization of the Program Group that the PDW adds to the Start menu during installation. By default, the PDW will not create a program group for an ActiveX control.

If the ActiveX control contains additional files, such as documentation or support utilities, this dialog allows you to build the group and add the files to the Start menu.

In this example, click the Next button.</li> The Install Location dialog box appears. This dialog allows you to customize where each main file of a package will be installed on the target computer. By default the PDW installs an ActiveX control into it's own folder on the target computer.

In this example, click the Next button to accept the default folder.</li> <li>The Shared Files dialog box appears. A Shared File is a file which is used by more than one program (a DLL or OCX is an example of a Shared File). When more than one program is dependent upon a file, the operating system keeps a count of how many programs use that file. This prevents one program from uninstalling a shared file that is needed by a program still installed on the computer.

In this example, click the Next button.</li> <li>The last dialog box, Finished, appears. This dialog gives you the chance to save all the options chosen into a script file. The script file can then be run to automate the distribution build process.

Click the Finish button.

At this time the PDW processes all the options selected and builds the distribution set for the ActiveX control.</li> <li>When the PDW has completed building the distribution set, a Packaging Report dialog box appears that contains additional information about the distribution.</li></ol>

The setup for the ActiveX control is now complete. All the files necessary to run the ActiveX control in a run-time environment are in the Package folder. The control can be installed by running the Setup.exe program, which is in the Package folder.

<div class="references_section">