Microsoft KB Archive/242433

= MOD2000: How to Create Context Sensitive HTML Help Files =

Article ID: 242433

Article Last Modified on 5/10/2001

-

APPLIES TO


 * Microsoft Office 2000 Developer Edition

-



This article was previously published under Q242433



For a Microsoft Office XP Developer version of this article, see 296231.



SUMMARY
In HTML Help Workshop, which is included in Microsoft Office 2000 Developer, you can create Help files in compressed HTML (.chm). This is a significant change from the Help workshop that is included in Microsoft Office 97 Developer Edition. Help Workshop in Microsoft Office 97 Developer Edition creates Winhelp files (.hlp).

This article demonstrates how to create a simple HTML Help file in HTML Help Workshop, and then how to use the Help file in a Microsoft Access form. The Help file uses context IDs to show different Help topics, depending on where you click the pointer in the form.

Creating this simple HTML Help file involves completing the following topics:
 * Creating two HTML files: one for the form and one for the control.
 * Creating a map file to define the context IDs.
 * Creating an alias file that associates each topic ID with a topic.
 * Compiling these files in HTML Help Workshop into a single compressed HTML file (*.chm).
 * Adding the path to the HelpFile property of a sample form.
 * Assigning context IDs to the form and to a control on the form.
 * Testing the form.

The result is a form on which you can press F1 while in a particular text box to get a particular Help topic. Pressing F1 anywhere else on the form displays the general form Help topic.



MORE INFORMATION
To create a compressed HTML file with context sensitive Help, follow these steps:

Creating the HTML Files

 * 1) Click Start, point to Programs, point to HTML Help Workshop, and then click HTML Help Workshop.
 * 2) On the File menu, click New. Click Project, and then click OK. Name the new project MyProject.
 * 3) On the File menu, click New.
 * 4) Click HTML File, and then click OK.
 * 5) In the HTML Title dialog box, type Form Help, and then click OK.
 * 6) Between the  tags, type This is the Help topic for the form.
 * 7) On the File menu, click Save File. The Save As dialog box appears.
 * 8) Save the file with the name Test1.htm. Make note of the folder where you saved this file.
 * 9) Close the Test1.htm file.
 * 10) On the File menu, click New.
 * 11) Click HTML File, and then click OK.
 * 12) In the HTML Title dialog box, type Control Help, and then click OK.
 * 13) Between the  tags, type This is the Help topic for the control.
 * 14) On the File menu, click Save File. The Save As dialog box appears.
 * 15) Save the file with the name Test2.htm. Make note of the folder where you saved the file.

Creating the Map File
 Click the Add/Remove topic files button. It is the second button down on the Project tab. Add the two files that you created earlier: Test1.htm and Test2.htm. Click Start, and then click Run. In the Open box, type Notepad, and then click OK. In Notepad, type the following lines:


 * 1) define 1 1001


 * 1) define 2 2001

</li> On the File menu, click Save as.</li> In the Save as type box, change the type to All Files.</li> Type the file name Map.h, and then click Save.</li></ol>

Creating the Alias File
<ol> In Notepad, click New on the File menu.</li> Type the following lines:

1=test1.htm;

2=test2.htm;

</li> On the File menu, click Save as.</li> In the Save as type box, change the type to All Files.</li> Type the file name Alias.h, and then click Save.</li></ol>

Compiling a Single Compressed HTML File

 * 1) In HTML Help Workshop, click the button for the HTMLHelp API Interface. This is the fourth button down on the left side of the Project tab.
 * 2) On the Map tab, click Header File.
 * 3) Click Browse, and then browse to the Map.h file that you created earlier in Notepad.
 * 4) Highlight Map.h, and then click Open. Note that you see #include Map.h in the list.
 * 5) Click the Alias tab, and then click Include.
 * 6) Click Browse, and browse to the Alias.h file that you created earlier in Notepad.
 * 7) Highlight Alias.h, and then click Open. Note that you see #include Alias.h in the list.
 * 8) Click OK.
 * 9) On the File menu, click Compile.
 * 10) Compile the Help file as MyProject.
 * 11) Verify that the MyProject.chm file has been created and make note of its location.

Adding the Path
<ol> In Access, create a new database named Database1.mdb. Create it in the same location where you created the Help file.</li>  In the Database1.mdb file, create the following form: <pre class="fixed_text">  Form: Test1 -  Caption: TestForm

Text Box Name: Field1

Text Box Name: Field2 </li> In Design view, click the form, and then on the View menu, click Properties.</li> Click the Other tab.</li> Set the HelpFile property to MyProject.chm.</li></ol>

Assigning Context IDs

 * 1) Set the HelpContextId property of the form to 1001, and then click OK.
 * 2) Select the Field2 control, and then on the View menu, click Properties.
 * 3) Click the Other tab.
 * 4) Set the HelpContextId property of the Field2 control to 2001. Press ENTER.

Testing the Form

 * 1) On the View menu, click Form View.
 * 2) Click the Field1 control, and then press F1. Note that the topic for the form appears. This is because the Field1 control does not have an associated topic and therefore defaults to the general form topic.
 * 3) Close the Help topic.
 * 4) Click the Field2 control, and then press F1. Note that the topic for the Field2 control appears.

<div class="references_section">