Accessing the Object Model in FrontPage from Design-Time Controls

Microsoft FrontPage Visual Basic

Accessing the Object Model in FrontPage from Design-Time Controls

Some of the content in this topic may not be applicable to some languages.

A design-time control (DTC) is one of a class of Microsoft ActiveX controls that is exclusively used at design-time as an aid to authoring Web site 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, see 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:

  • Preview— returns a string containing the controls preview text.
  • Tag— returns the tag context for the preview string.

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

  • QueryBuilder
  • Data connections
  • Visual InterDev object model for .asp pages

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 (see FPHTMLObjectElement object). 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 FrontPage 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 PageWindowEx

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.