Visual Basic Concepts
ActiveX Document Similarities to ActiveX Controls
See Also
In many ways, ActiveX documents resemble ActiveX controls. Knowing how they are similar can be of some benefit, as the programming techniques, caveats, and strategies apply to both.
Here are a few of the relevant similarities:
- Like an ActiveX control, an ActiveX document can't exist without a container. Whereas an ActiveX control is contained in a form, UserDocument, or UserControl, the ActiveX document is contained in a container such as Internet Explorer or Microsoft Binder.
- The author of a control cannot know for sure which development environment the control will eventually be used in. Likewise, the developer of an ActiveX document cannot know which container will be used to view the ActiveX document.
- The UserDocument object also features several events that are also found on the UserControl object. The common events include: Initialize, InitProperties, ReadProperties, EnterFocus, ExitFocus, WriteProperties, and the Terminate event.
Because of the great similarity between ActiveX documents and ActiveX controls, much of what is written in "Building ActiveX Controls," also applies to building ActiveX documents. The following topics are of particular relevance:
- "The UserControl Object," discusses the core document for ActiveX controls. This object has great similarities to the UserDocument object.
- "Controls You Can Use As Constituent Controls" discusses the controls that can be placed on a UserControl. These same points can generally be applied to an ActiveX document.
- "Object Models for Controls" discusses a strategy of dealing with complex controls, which can also be applied to ActiveX documents.
- "Adding Internet Features to Controls" explains, in detail, the AsyncRead method, the AsyncReadComplete event, and the Hyperlink object. These same features are available for ActiveX documents.
- "Adding Properties to Controls" and "Adding Methods to Controls" show you how and why to add public properties and methods to controls. The same methods apply (in part) to ActiveX documents.
- "Creating Robust Controls" gives a thorough list of do's and don'ts for creating robust controls. Many of the principles apply to ActiveX Documents as well.