Partilhar via


Visual Basic Concepts

Creating an ActiveX Document

The series of step-by-step procedures in this chapter builds a simple combination of two ActiveX documents and two forms. The project is not intended to be a functioning application, but building it will quickly demonstrate object lifetime, global objects, and a set of components working together in Internet Explorer. You will also see how to debug an ActiveX document using Visual Basic's debugging tools.

All of the subjects introduced in these procedures are covered in greater depth in later chapters. References to in-depth material will be found in each procedure. In addition, "Building ActiveX Documents" shows how you can use the ActiveX Document Wizard to make building an ActiveX document even easier.

Note   To complete the step-by-step procedures in this chapter, you must have Microsoft Internet Explorer and access to the Internet or an intranet. You can install Internet Explorer from the Tools directory of your Visual Basic CD-ROM.

The procedures for creating the ActXDoc project build on each other, so the sequence in which you perform the procedures is important.

Topics

Creating the ActXDoc Project

Shows how to create a single ActiveX document in the ActXDoc project.

Running and Debugging the ActXDoc Project

Explains how to run the ActXDoc project and view the ActiveX document in Internet Explorer.

Adding a Second ActiveX Document to the ActXDoc Project

Shows how to add a second ActiveX document named SecndDoc to the project.

Adding a Form to the ActXDoc Project

Illustrates how to add a standard form to the project.

Adding a Property to the UserDocument

Explains how to add a public property and two methods to the ActiveX document. These are exposed and can be used by the SecndDoc ActiveX document or by a form.

Saving Properties to the PropertyBag

Illustrates how to save property values of the UserDocument object to the PropertyBag through the WriteProperties event and retrieve property values through the ReadProperties event.

Adding a Menu to the ActXDoc Project

Shows how to add a menu that will be visible in the host application to the FirstDoc ActiveX document.

Life Cycle of a UserDocument

Explains the sequence of events for an ActiveX document

ActiveX Document Creation Recap

Outlines the typical process of designing and creating an ActiveX document.

Sample application

ActXDoc.vbp

This application fills in all the properties, methods, and events required to create an ActiveX document. It shows additional ActiveX document creation features, at the expense of some of the basic material covered in the step-by-step procedures. The sample applications are listed in the directory.