Visual Basic Concepts

Deploying ActiveX Components

In addition to providing objects for use by client applications, some components can function as standalone desktop applications, in the way Microsoft Excel does. If your component is in this category, you can distribute it as you would any Visual Basic application.

"Distributing Your Applications," in the Visual Basic Programmer’s Guide, contains all the information you need to use the Package and Deployment Wizard, or to create a custom Setup for your application.

This topic and the following related topic discuss the distribution of components that are not standalone applications.

Ways to Distribute Components

There are several ways to distribute a component. For example:

  • As part of your own Visual Basic applications.

  • As a tool users can access from Automation-enabled desktop applications such as Microsoft Excel and Microsoft Access.

  • As a component other developers can include in their applications, or use with the Internet.

  • As part of an enterprise application, running on a remote computer (requires the Enterprise Edition of Visual Basic).

For all of these distribution scenarios except the first, you can create a standalone Setup for your component.

Distributing a Component as Part of a Visual Basic Application

To distribute your component as part of a Visual Basic application, you can use Package and Deployment Wizard to create a setup program for the application. If your application has a reference to the component, Package and Deployment Wizard will locate the component using its registry entries, and include it — along with its support files — in the list of files needed to create distribution media.

As with components that are also standalone desktop applications, this scenario is largely covered by ordinary application setup. The only additional consideration is the use of implemented interfaces.

Including Type Libraries for Implemented Interfaces

If you’ve used the Implements keyword to add additional interfaces to your classes, as described in "Providing Polymorphism by Implementing Interfaces" in "General Principles of Component Design," you may need to include the type libraries for those interfaces in Setup for your component.

You need to include the type library that includes a particular interface if:

  • Any classes the interface has been added to are provided by out-of-process components.

  • The application will provide objects to other applications, and some of those objects implement the interface.

The reason type libraries need to be included with your application in these two situations is that invoking an object’s properties and methods cross-process requires marshaling their arguments. In order to marshal the arguments, type library information must be available.

Standalone Setup for a Component

To distribute your component for use by other developers, by Internet providers, or as part of an Enterprise application, use Package and Deployment Wizard to create a standalone setup program. The Package and Deployment Wizard will automatically include necessary support files. Be sure to include your Help file.

Important   For in-process components, see the related topic "Setting Base Addresses for In-Process Components," which contains important information regarding base addresses and their effect on the performance of your component.

Developers who use your component can install it on their computers, and then use the Package and Deployment Wizard or the Setup Toolkit to include it in the distribution media for their applications.

The steps required to produce Setup for your component will also give you the file dependency information you need to provide to developers who want to use your component with Microsoft Excel, Microsoft Visual C++, or other Automation-enabled development tools.

Distributing Type Libraries for Implemented Interfaces

If you’ve used the Implements keyword to add additional interfaces to your classes, as described in "Providing Polymorphism by Implementing Interfaces" in "General Principles of Component Design," you need to include the type libraries for those interfaces in Setup for your component.

Special Considerations

Distribution issues particular to ActiveX controls — such as licensing — and to ActiveX documents can be found in "Building ActiveX Controls" and "Building ActiveX Documents."

If you plan to use your component for Internet development, the Package and Deployment Wizard can create CAB files for you. You can obtain the most up-to-date information on Internet setup options from the Microsoft Visual Basic Web site.

For More Information*   See "Distributing Your Applications," in the *Visual Basic Programmer’s Guide.