Visual C++ 6 Unleashed

Visual C++ 6 Unleashed

By MICKEY WILLIAMS and David Bennett

Authoring Help Topics Using WinHelp

The actual text of all of your WinHelp help topics is created in rich-text format (RTF) files. Rich-text format allows you to create files that use only the ASCII character set, but can also include additional formatting information, as well as special information about links.

For some reason, Microsoft has never felt that it needed to include the ability to edit RTF files from within Developer Studio. Their recommendation is to use an additional editor, such as Microsoft Word, which can save files in an RTF format. However, because RTF files only use the standard ASCII character set, you may use any plain ASCII editor to work with the .rtf files, although the files are much more difficult to work with in plain ASCII.

For example, see Figure 33.9 for the simple .rtf file as shown in Microsoft Word.

33fig09.gif

Figure 33.9 RTF in Microsoft Word.

The same file would look like the one in Figure 33.10 in a native ASCII text editor, such as Notepad.

33fig10.jpg

Figure 33.10 RTF in Notepad.

Creating Help Topics

Individual topics in your RTF files are separated by a hard page break. These are used to separate the RTF text into the individual pages that will be displayed by WinHelp. In addition, each topic may contain several special footnotes.

To start with, most of your topics should include a footnote using the special character (#), which is used to assign a context name to the topic. This context name given in the footnote text is used for referencing this topic as the destination of a hypertext link or directly from your application.

Secondly, you might want to add a footnote using the special character (K). The text for this footnote lists keywords that may be used in searches to find this particular topic. These keywords appear to the user in the Index tab of the WinHelp dialog.

In addition, you may specify a footnote with the ($) character, which assigns a topic name. Topic names assigned with this footnote will appear to the user in the Find tab of the WinHelp dialog.

Adding Hot Spots

I'm sure that by now you are familiar with using help files that allow you to click certain keywords or phrases to move to a new topic. These are known as hot spots, or hypertext links. To implement these hot spots in your help files, you will need to add a few special things to your RTF file.

The displayed text that you want to make a hot spot should be formatted with double underlining. Immediately following the double underlined text, add a context name, which should be formatted as hidden text. This hidden text gives the context name for a topic somewhere in your help file. Remember that the context name for a topic is assigned using the # footnote.

This is all you need to do to add hypertext links to your help files. However, you might also want to use tables to format groups of links, as you will see in the .rtf files gener ated by AppWizard.

Including Graphics in Help Files

As you will see in the .rtf files that are created by AppWizard, you can also add graph ics to your help files. You can include bitmap files anywhere in your help file by adding a directive to your .rtf file in the location where you intend to display the bitmap. The format of the directive looks like this:

{bmc MyPic.bmp}

The directive is enclosed in curly braces and uses the bmc command to indicate that the filename of a bitmap file will follow.

Share ThisShare This

Informit Network