Adding Standard Items to the Help Menu

Users select the Help on Viewer command from the Viewer's Help menu to display help (in a new instance of Viewer). To make sure this command displays help for your title, you include commands in the [CONFIG] section of your project file like the following commands from the USA.MVP project file:

[CONFIG]
.
.
.
RegisterRoutine("ftui", "MVHelp", "USSS")
AppendItem("mnu_hlp", "mvhelp", "&Help on Viewer...",
           "MVHelp(hwndApp, qchPath, `usahelp.mvh',
                   `JI("usahelp.mvh", "IDM_helpINDEX")')")
AddAccelerator(0x70, 0, "MVHelp(hwndApp,qchPath,`usahelp.mvh',`')") 

The RegisterRoutine command should be familiar to you: it's the Viewer command that registers functions in external dynamic-link libraries (DLLs) so you can use those functions the same as Viewer commands. In this case, it's used to register the MVHelp function from the full-text search library FTUI.DLL as a Viewer command. MVHelp runs another instance of Viewer and opens the help file given in the command.

We introduced the AppendItem command in Chapter 10. The AppendItem command adds the Help on Viewer item to the Help menu (mnu_hlp) after the standard About item. The MVHelp command passed in the AppendItem command opens the Viewer help file USAHELP.MVH and jumps to the contents topic for that file. (The contents topic for USAHELP.MVH has context string “IDM_helpINDEX.”)

Finally, as you'll remember from Chapter 10, the AddAccelerator command sets up a key sequence that executes any Viewer command. In this example, the standard key for launching help, F1, is the associated with the Help command on the menu. This accelerator key runs Viewer and loads the USAHELP.MVH file in the same way as the Help command. (F1 corresponds to the virtual key code 0x70 given in the AddAccelerator command.)

See Chapter 18 if you need more information about the RegisterRoutine and AddAccelerator commands or about virtual key codes.

Note:

Viewer displays help only for your Viewer title. The standard Help application for the Windows graphical environment is used to display help for all other Windows applications.