Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

MOD2000: How to Create Context Sensitive HTML Help Files


View products that this article applies to.

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.

↑ Back to the top


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 <BODY> 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 <BODY> 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

  1. Click the Add/Remove topic files button. It is the second button down on the Project tab.
  2. Add the two files that you created earlier: Test1.htm and Test2.htm.
  3. Click Start, and then click Run.
  4. In the Open box, type Notepad, and then click OK.
  5. In Notepad, type the following lines:
    #define 1 1001
    #define 2 2001
  6. On the File menu, click Save as.
  7. In the Save as type box, change the type to All Files.
  8. Type the file name Map.h, and then click Save.

Creating the Alias File

  1. In Notepad, click New on the File menu.
  2. Type the following lines:
    1=test1.htm;
    2=test2.htm;
  3. On the File menu, click Save as.
  4. In the Save as type box, change the type to All Files.
  5. Type the file name Alias.h, and then click Save.

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

  1. In Access, create a new database named Database1.mdb. Create it in the same location where you created the Help file.
  2. In the Database1.mdb file, create the following form:
       Form: Test1
       -----------------
       Caption: TestForm
    
       Text Box
       ------------
       Name: Field1
    
       Text Box
       ------------
       Name: Field2
    					
  3. In Design view, click the form, and then on the View menu, click Properties.
  4. Click the Other tab.
  5. Set the HelpFile property to MyProject.chm.

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.

↑ Back to the top


References

For more information about creating header files, in HTML Help Workshop, click Help Topics on the Help menu, type header files on the Search tab, and then click List Topics to view the topics returned.

↑ Back to the top


Keywords: kbhowto, KB242433

↑ Back to the top

Article Info
Article ID : 242433
Revision : 2
Created on : 5/10/2001
Published on : 5/10/2001
Exists online : False
Views : 221