Accessing the Object Model in FrontPage from Design-Time Controls

See Also

A design-time control (DTC) is one of a class of ActiveX controls that is exclusively used at design-time as an aid to authoring web content. DTCs function just like embedded wizards—they can be edited to modify the output that the DTC generates on the web page. Once the file is closed, the DTC becomes inactive—the text that the DTC generated has been embedded into the file.

How are design-time controls different from ActiveX controls?

Design-time controls do not contain a binary run-time component, but do have a special interface that provides the ability for the design-time control to persist and generate text. Design-time controls and ActiveX controls can co-exist on the same web page. For more information on DTCs refer to the documentation on the Microsoft workshop Web site for design-time controls.

How do design-time controls differ from Visual InterDev?

FrontPage and Microsoft Visual InterDev are compatible in most areas. For design-time controls, FrontPage provides full access to the Document object model that's available in Microsoft Internet Explorer. The Web object model is also available for design-time controls and provides a rich array of objects, events, methods, and properties. FrontPage also provides support for removing tags (or text) that is inserted into a document by design-time controls.

Properties supported by FrontPage that are not supported by Microsoft Visual InterDev:

Built-in options in Visual InterDev that FrontPage doesn't support:

How to access the FrontPage object model from a design-time control

A design-time control is a type of ActiveX control, and thus accesses its host's object model similarly to other controls. The design-time control has a UserControl property that returns the UserControl object. This object in turn has an Extender property that returns the environment where the ActiveX control resides. The expression, UserControl.extender returns the environment for the specified DTC.

The Extender property returns FPHTMLObjectElement object and provides access to all of the properties and methods in the FPHTMLObjectElement object. One of these properties is the Document property that accesses the Page object model for the document where the design-time control resides. The following statements illustrate how to access the Document property from a DTC.

Dim myDTC As FPHTMLObjectElement
Dim myDoc As FPHTMLDocument
Dim myPageWindow As PageWindow

Set myDTC = UserControl.Extender
Set myDocument = myDTC.document
Set myPageWindow = myDoc.parentWindow.external

The last Set statement illustrates how to access the Web object model from the Page object model.