About Window Types
When displaying an HTML Help topic the HTML Help engine creates a window in which the topic is displayed. It does so based on a window type. The window type defines the HTML Help window's look and feel. For example you can create a simple window type that shows only a topic but no toolbar or table of contents (TOC) or you can create a window that includes all the navigational controls such as a toolbar, TOC, Index and Search tabs. So simply put a window type is a named collection of attributes which define the appearance of the window in which your topics are displayed. You can define and use as many different window types as you want, they are only limited by the systems memory. However, you will usually only need two or three different window types. For example one that displays only a topic and one that displays a full featured window with all the navigational aids.
Creating Window Types
You can create a window type in two ways. First the Help Author can use the HTML
Help Workshop (or another commercial package) to define the window type. In this case the
window type definition is compiled into the HTML Help file and the programmer can use it
without additional work by specifying the name of the window definition (as defined by the
author) where required. Second the programmer can dynamically create window types when the
need arises by using the HH_SET_WIN_TYPE command. This command requires a THHWinType
structure which allows you to define the window type in detail. Its easier to have the
HTML Help author define the window types, because she can use the GUI provided by her
authoring package, but sometimes it is necessary to dynamically create a window type at
runtime, for example when using embedded HTML Help. See THHWinType and HH_SET_WIN_TYPE for details. Note that the
accompanying Embedded demo project uses this technique to create a window type allowing it
to use HTML Help embedded in a form.
Global vs Local
A window type is always associated with the compiled help (.chm) file for which
they we're created. This means that you can create identically named window types for
different helpf files without these window types affecting each other. The exception to
this rule are global window types. A global window type is a normal window type who's name
is prefixed with "$global_" or which is created with the pszFile member of the
THHWinType structure set to nil. Such a window type can be shared by multiple compiled
help (.chm) files. Note that if several helpfiles specify identically named global window
types that only the first instantiation of this window type will be usable. For example,
if both A.chm and B.chm define a global window type and you open these files in that
order, then B.chm will automatically use the window type as defined by A.chm.
Default Window Type
When you programmatically display a topic you can can specify the window
type HTML Help should use to display the topic. You do this by appending '>WindowName'
to the pszFile parameter of the HtmlHelp() function (this is described in detail in HTML Help URLs). If the specified window type has not
been used before HTML Help instantiates this window type and uses it to display the topic.
If the window type was already used before it is reused. If you don't explicitly specify a
window type HTML Help will use the default window type as specified in the compiled help
(.chm) file. The HTML Help author specifies the default window type by using the Project
Properties dialog when creating the helpfile. When the helpfile does not specify a default
window type HTML Help uses the default Help Viewer which is described next. Note that this
is also what happens when the user double-clicks the compiled help (.chm) file from
explorer. Unless you are satisfied with the default Help Viewer window you should always
create at least one window type and set this window type as the default.
The Help Viewer
The Help Viewer is the standard window in which the helpfile is displayed
when there is no default window type and the programmer did not explicitly specify a
window type when calling HtmlHelp(). Below is a screenshot of how this window looks.
As you can see the Help Viewer contains three panes, the toolbar, the topic pane and the navigation pane. The toolbar is fairly self explanatory, it contains a number of toolbar buttons allowing for navigation through the helpfile and manipulation through the Hide and Options buttons. The Topic pane is where the HTML Help topics are displayed. Basically it is a window that houses shdocvw to do the actual displaying. Finally there is the navigation pane which houses a number of tabs used for navigating the helpfile. Note that even though they are not shown, the Help Viewer is capable of displaying many more toolbar buttons and also has a Favorites tab. See the reference on THHWinType for details.