CHM: Calling up F1 Topic: Map ID vs. Keyword

Pete Lees pd.lees at btinternet.com
Thu Mar 6 04:18:29 MST 2008


Keith,

> In one of our applications, we use a CHM as the
> Help file. In the application, when the user clicks
> in the Address text box (for example) and presses
> F1, a Help topic describing that text box appears.
> In the past, I've always seen Map IDs used to call
> up such F1 topics. However, there is apparently
> another way to do this:

Yes, that's right. A developer who uses the HTML Help
API to connect a .chm file to an application can
choose from a number of different commands for
invoking context-sensitive help. The two principal
ones are HH_HELP_CONTEXT, which opens the topic that
is mapped to the specified context integer, and
HH_DISPLAY_TOPIC, which opens the topic with the
specified file name. For an example of the latter, see
Microsoft's HTML Help API Reference:

http://msdn2.microsoft.com/en-us/library/ms670084(VS.85).aspx

In .NET applications, developers typically use
"HelpProvider" components to invoke context-sensitive
help, but the same options are available here too.
(HelpProviders are essentially just wrappers for the
HTML Help API.) See the following page for code
samples:

http://helpware.net/mshelp2/demo2/h1xNET.htm

This page is a little out-of-date, because the
statement at the beginning about .NET applications not
supporting help calls that use numeric context IDs is
no longer true. Microsoft added a method for doing
this in .NET 2.0.

> Apparently, the HTM file is somewhere embedded
> within the CHM(?!), and the Address.htm topic can
> be located and then opened.

Although the two aren't completely analogous, you can
think of a .chm file as resembling a .zip file -- a
container for a multitude of smaller files. In fact,
you can examine the contents of a .chm file with a
freeware utility like KeyTools
(http://www.keyworks.net/keytools.htm) and see all the
source files.

I like your summary of the pros and cons of using file
names and context integers to invoke context-sensitive
help. Off the top of my mind, I can't think of a
compelling reason to use the file names.

Pete


More information about the TECHWR-L mailing list