Working with the HTML Help ActiveX Control

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Many of the features available in HTML Help are implemented through the HTML Help ActiveX control (HHCtrl.ocx). The HTML Help ActiveX control is used to provide navigation features (such as a table of contents) to display secondary windows and pop-up definitions, and to provide other features. The HTML Help ActiveX control can be used from topics in a compiled Help system as well as from HTML pages displayed in a Web browser. The functionality provided by the HTML Help ActiveX control will run in the HTML Help Viewer or in any browser that supports ActiveX technology, such as Microsoft® Internet Explorer (version 3.01 or later). Some features provided by the HTML Help ActiveX control are available only when it is used from a compiled HTML Help file (.chm) that is displayed by using the HTML Help Viewer.

The most commonly used features supported by the HTML Help ActiveX control are:

  • Table of contents (displayed in a tree control)
  • Index
  • Secondary windows (available only from a .chm file displayed in the HTML Help Viewer)
  • The ability to size and position windows (available only from a .chm file displayed in the HTML Help Viewer)
  • Pop-up definitions
  • Context-sensitive Help (available only from a .chm file displayed in applications that support this functionality)
  • Shortcut buttons to run other programs (available only from a .chm file displayed in the HTML Help Viewer)
  • Related Topics links
  • Training card Help (step-by-step interactive help that is available only from a .chm file displayed in the HTML Help Viewer)
  • Splash screen

The best way to insert the HTML Help ActiveX control in an HTML file is by opening the HTML file in HTML Help Workshop and clicking HTML Help Control on the Tags menu. A wizard appears that lets you choose what kind of command to use with the control and helps you define other parameters to apply to that command. When you click Finish, the wizard inserts the appropriate <OBJECT> and <PARAM> tags in the HTML file.

For example, the following HTML fragment inserts an instance of the HTML Help ActiveX control that creates a Related Topics button to display a dialog box that lists two topics:

<OBJECT ID=HHCtrl TYPE="application/x-oleobject"
    CLASSID="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
    CODEBASE="HHCtrl.ocx#Version=4,73,8259,0"
    WIDTH=12
    HEIGHT=12>

    <PARAM NAME="Command" VALUE="Related Topics">
    <PARAM NAME="Button" VALUE="Text:Related Topics">
    <PARAM NAME="Item1" VALUE="First topic;topic1.htm">
    <PARAM NAME="Item2" VALUE="Second topic;topic2.htm">
</OBJECT>

Note   Unlike many Microsoft® ActiveX® controls, the HTML Help ActiveX control can be inserted only in HTML files. Even though the HTML Help ActiveX control is available as the HHCtrl object in the list of controls that you can add to the Toolbox in Office applications, if you try to insert the control in a form or document, an error message is displayed. The version number shown in the previous sample HTML code for the CODEBASE attribute (

Version=4,73,8259,0

) is the current version of the control at the time of this writing. When you insert an HTML Help ActiveX control by using HTML Help Workshop, the version number will reflect the version of the control that is installed on your computer.

When you have the <OBJECT> tag for an instance of the HTML Help ActiveX control inserted in an HTML page, you can use Microsoft® JScript® or Microsoft® Visual Basic® Scripting Edition (VBScript) to work with the control. For example, the following HTML fragment uses an instance of HHCtrl.ocx and the control's TextPopup method in JScript to create a text pop-up:

<OBJECT ID=HHCtrl TYPE="application/x-oleobject"
    CLASSID="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
    CODEBASE="HHCtrl.ocx#Version=4,73,8259,0">
</OBJECT>

<P>This is a 
<A HREF=JScript:HHCtrl.TextPopup(MyText,"Verdana,10",9,9,-1,-1)>
pop-up</A>.
</P>
<SCRIPT>MyText="This is how a text pop-up window looks."
</SCRIPT>

If you prefer to use VBScript, you can create an identical text pop-up by replacing JScript in the <A HREF> tag with VBScript like this:

<A HREF=VBScript:HHCtrl.TextPopup(MyText,"Verdana,10",9,9,-1,-1)>
pop-up</A>.

The HTML Help ActiveX Control vs. the HTML Help JScript Applet

Although the HTML Help JScript applet provides much of the same functionality as the HTML Help ActiveX control, the JScript applet is more useful when it is used on a Web site than when it is used in a compiled HTML Help file. The JScript applet does not provide as many features as the ActiveX control does, and it loads the table of contents and index more slowly than the ActiveX control does. However, the JScript applet allows your Web site to use HTML Help navigation features and still be compatible with browsers that don't support ActiveX controls.

See Also

Working with the HTML Help JScript Applet | Adding Help to Your Custom Application | What Is Microsoft HTML Help?| HTML Help Tools and Features | What Kinds of Help Systems Can You Create? | Displaying HTML Help | Deploying HTML Help