Microsoft KB Archive/189453

= How To Prepare HTML Help Files for Context-Sensitive Help =

Article ID: 189453

Article Last Modified on 7/2/2007

-

APPLIES TO


 * Microsoft HTML Help 1.3
 * Microsoft HTML Help 1.1
 * Microsoft HTML Help 1.21

-



This article was previously published under Q189453



SUMMARY
This article describes how to set up an HTML Help project file so that the HTML Help API command, HH_HELP_CONTEXT, can be used in an application. This is actually the first step of a two-step process. Step two is to set up your application to use the HTML Help API to invoke context-sensitive Help.



MORE INFORMATION
This article assumes that you already have an existing help project file to work with.

NOTE: It is recommended that you use a text editor, such as Microsoft Notepad or Microsoft WordPad, to edit the MAP and ALIAS sections of the HTML Help project file. For additional information, please see the following article in the Microsoft Knowledge Base:

188444 BUG: Editing MAP or ALIAS in the HTML Help Workshop Causes Error

Step-by-Step Procedures
  Add the [ALIAS] section to the HTML Help project file. Following is an example of the [ALIAS] section: [ALIAS] IDH_FILE_NEW  = newfile.htm IDH_FILE_OPEN = openfile.htm IDH_FILE_SAVE = htm\savefile.htm The purpose of the [ALIAS] section is to associate .htm files with constants. The constants are not defined in the [ALIAS] section (see the following step 2). The constants should not be numbers. For example, the following statement in the [ALIAS] section is not valid: 5 = newfile.htm NOTE: If an .htm file is in a subfolder, the name of the subfolder should be included. See IDH_FILE_SAVE in the above [ALIAS] section.   Add the [MAP] section to the HTML Help project file. The [MAP] section is required when you use an [ALIAS] section. The [MAP] section should appear after the [ALIAS] section. The purpose of the [MAP] section is to define or give numeric values to the constants in the [ALIAS] section. Following is an example of the [MAP] section: [MAP] NOTE: If the application that will use the Help files is written using Visual C++ the [MAP] section can also appear as follows: [MAP] In this case, the file Context.h contains the following define statements:  Save and close the project file with the text editor. Open the project file in HTML Help Workshop, and compile it.
 * 1) define IDH_FILE_NEW  1
 * 2) define IDH_FILE_OPEN 2
 * 3) define IDH_FILE_SAVE 3
 * 1) include "context.h"
 * 1) define IDH_FILE_NEW  1
 * 2) define IDH_FILE_OPEN 2
 * 3) define IDH_FILE_SAVE 3

Test the compiled HTML Help file (.chm) by performing the following steps in HTML Help Workshop:


 * 1) Open the project file.
 * 2) From the Test menu, click HTMLHelp API.
 * 3) In the Command list select HH_HELP_CONTEXT.
 * 4) In the Window edit box, enter the name of a window defined in the [WINDOWS] section. If you do not have a [WINDOWS] section, this field should be blank.
 * 5) In the Map Number edit box, enter a number defined in the [MAP] section. When you press the Test button, the correct topic should appear.

