共用方式為


Help: Support Tools

OverviewHow Do I

You will use three main tools to develop your application’s Help system: AppWizard, MakeHm, and the Windows Help Compiler. You also need an editor, such as Microsoft Word for Windows, that can edit rich text format (.RTF) files. You can use the Visual C++ bitmap editor to create bitmaps to include in your Help files.

Note You can upgrade your Help Project files to a 4.0 format with the Windows 4.0 Help compiler. This gives you access to the Windows 4.0 Help Workshop, a graphical help authoring environment with many useful features. If you’re planning on porting your applications to other platforms, first ensure that those platforms have a compiler that’s compatible with the 4.0 Help Project file before upgrading.

Choosing the Help Option in AppWizard

AppWizard is your first tool for implementing context-sensitive Help. Check the Context-Sensitive Help checkbox in AppWizard. AppWizard then provides the message-map entries in your CWinApp-derived class that connect the whole help mechanism, adds a menu item to the Help menu, and adds a button to the toolbar resource that the user can press to invoke Help mode.

AppWizard also creates a set of skeletal starter files, as shown in the following table.

AppWizard-Supplied Help Files

File Description
MakeHelp.bat A batch file that manages help ID mapping and calls the Help Compiler. Only supplied in Visual C++ 6.0 for compatibility with previous releases.  Custom build rules for the .hpj, .cnt and resource.h file replace the functionality of MakeHelp.bat.
HLP\<project>.HPJ A Windows Help project file that the Windows Help Compiler uses.
HLP\<project>.CNT A file containing the information needed to create the Help Contents screen.
HLP\*.BMP Various bitmap files used with the supplied Help files.
HLP\*.RTF Help files in .RTF format that contain starter help for the application components supplied by the framework.

The MakeHelp.bat file is in your project directory. The .BMP, .RTF, .CNT, and Help project file (.HPJ) are in an HLP subdirectory that AppWizard creates in your project directory.

You can edit these files as described in Help: Authoring Help Topics to fill in application-specific help information.

Using MakeHm

Once you’ve created an AppWizard application with help support, you can build help simply by clicking Build <project> on the Build menu. This command runs invokes the custom build rules on the .hpj, .cnt and resource.h files and create an .HLP file..

If the resource.h file changed, MakeHm runs. MakeHm reads your project’s RESOURCE.H file and creates a help mapping (.HM) file. This .HM file defines help-context IDs corresponding to the resource IDs in your RESOURCE.H file, so that each dialog, menu item, or other resource has a help-context ID associated with it.

Your project’s .HPJ file contains a statement in its [MAP] section that includes your project’s .HM file, as well as the standard .HM file included with MFC. The Help Compiler uses the help-context IDs in these .HM files to determine which Help topic is associated with each dialog, menu item, or other resource.

Whenever you add new resources to your project, you must add new Help topics for those resources to your .RTF files and then recompile your Help file. For more information, see in Tutorials.

Custom build rules will run the Windows Help Compiler to create the .HLP file if the .hpj file changes. The Help Compiler creates the .HLP file in your application’s main source code directory. If a Debug and/or Release subdirectory already exists, the .HLP file is copied to that subdirectory. This is useful because when you run either the Debug or Release version of your application, it will expect to find the .HLP file in the same directory as the debug or release executable file.

If you add new resources for which you wish to implement help contexts, compile the .HPJ from either the command line or from within the integrated development environment.