HH_DISPLAY_TOPIC

Displays a help topic.

Argument Description
hwndCaller Handle of the owner window or 0
pszFile HTML Help URL: Compiled help (.chm) file [::/Topic] [>Window]
uCommand HH_DISPLAY_TOPIC
dwData Topic to display or 0

Return value:
Returns the handle of the help window. If the topic could not be found the helpfile is opened anyway and a generic "The topic could not be displayed" topic is shown. The return value will still be the handle of this window. The command only returns 0 when the specified helpfile itself could not be found.

Description:
The HH_DISPLAY_TOPIC command displays the specified topic. The pszFile parameter specifies the helpfile from which to display a topic. The topic to be displayed can be specified either by using the dwData parameter or by specifying it as part of the pszFile parameter. If you do not specify a topic the helpfile's default topic will be displayed. Optionally you can specify the window in which the topic is to be displayed by appending a greater then sign ('>') followed by the window name to the pszFile parameter. If you don't specify a window name or the window is not defined then the topic will be opened in a default window. The window is created automatically if it hadn't been created yet.

The mode in which the help window functions is determined by two things: the hwndCaller parameter and whether or not the "Child Window" flag is set in the window definition.

Child Window flag not set
If you specify 0 or GetDesktopWindow as the hwndCaller parameter then the help window functions in "sibling" mode. Meaning that the help window is displayed alongside your applications window and the user can freely switch between the two windows. If you specify a window handle as the hwndCaller parameter (e.g. the mainform's handle) then the help window functions in "Owned" mode. This is exactly the same as Sibling mode except that the help window always appears on top of your applications window.

Child Window flag set
In this case you cannot specify 0 for the hwndCaller parameter because that will cause an error. The help window now functions as a child of the window specified as the hwndCaller parameter. This is very similar as an MDI child window where the help window is the child and your applications window is the parent.

Examples:
Both of the following two examples show the HtmlHelp.htm topic from the JediHtmlHelp.chm helpfile. The first one explicitly specifies the window type (Main) while the second example uses the default window type - which also happens to be Main. The difference between the two examples is in how the topic is specified.

HtmlHelp(0, PChar('JediHtmlHelp.chm>Main'), HH_DISPLAY_TOPIC, DWORD(PChar('HTML\Api Reference\Functions\HtmlHelp.htm')));

HtmlHelp(0, PChar('JediHtmlHelp.chm::/HTML\Api Reference\Functions\HtmlHelp.htm'), HH_DISPLAY_TOPIC, 0);

See also:
HH_HELP_CONTEXT

HH_DISPLAY_TEXT_POPUP