How To Prepare HTML Help Files for Context-Sensitive Help

Заявление об отказе от обязательств для неподдерживаемых продуктов

Эта статья содержит сведения о продуктах, поддержка которых корпорацией Майкрософт прекращена. Поэтому она предлагается «как есть» и обновляться не будет.

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

  1. 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.
  2. 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]
    #define IDH_FILE_NEW 1
    #define IDH_FILE_OPEN 2
    #define IDH_FILE_SAVE 3
    NOTE: If the application that will use the Help files is written using Visual C++ the [MAP] section can also appear as follows:

    [MAP]
    #include "context.h"
    In this case, the file Context.h contains the following define statements:

    #define IDH_FILE_NEW   1
    #define IDH_FILE_OPEN 2
    #define IDH_FILE_SAVE 3
  3. Save and close the project file with the text editor.
  4. Open the project file in HTML Help Workshop, and compile it.

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.

References

HTML Help Web Site:
For additional information, please see the following articles in the Microsoft Knowledge Base:

189086 How To Create Context-Sensitive HTML Help in a Visual Basic App
191118 How To Create Context-Sensitive HTML Help in an MFC Application
Свойства

Номер статьи: 189453 — последний просмотр: 22 июня 2014 г. — редакция: 1

Отзывы и предложения