Partilhar via


Visual Basic Concepts

Design Considerations for ActiveX Documents

Before designing an ActiveX document, you must be aware of a few considerations.

  • ActiveX documents are not stand-alone applications.

    An ActiveX document can only exist in a container. Because containers vary, you can't always predict the capabilities and limitations of your ActiveX document environment. At best, you can target a particular container or set of containers, and degrade gracefully in all others.

  • For ActiveX projects that need to exchange data between multiple ActiveX documents, you must implement global object variables and object references.

    Global object references, however, come with some overhead: you must track them to ensure they aren't overwritten inadvertently, and you must be sure that they are released. This is covered in more detail in "Ensuring Communication Among ActiveX Documents" in this chapter.

  • Navigation, or how to get from one ActiveX document to another, may vary from one container to another.

    For example, to show another ActiveX document in the Visual Basic development environment, you must use the CreateToolWindow function — which doesn't require the .vbd file. In contrast, to show a second ActiveX document in Internet Explorer, you must use the Hyperlink object's NavigateTo method with the .vbd file.

  • To enable one ActiveX document to pass data to another, you must implement public properties or methods.

  • You cannot place an OLE Container control or embedded objects (such as Microsoft Word or Microsoft Excel documents) on a UserDocument.

  • In-Process and Out-of-Process ActiveX Documents