# ShowHtmlHelp

int ShowHtmlHelp (const char helpFile[], unsigned int command, void *additionalData);

## Purpose

Displays an HTML help (.chm) file and controls the HTML Help viewer.

This function requires that the HTML Help components server, specifically hhctrl.ocx, is present on your system.

Do not call this function from more than one thread in your program. Do not interactively run this function panel or call this function from the Interactive Execution window. Because the HTML Help components are not multithread–safe, your program might hang if you call this function under any of these circumstances.

After calling this function successfully, do not exit from your program until the HTML Help windows have completely initialized. If you exit your program before these windows have initialized, you may get a General Protection Fault.

## Parameters

Input
Name | Type | Description
helpFile | const char [] | Pass the path to the help file. Pass NULL in this parameter when you pass HH_CLOSE_ALL in the command parameter of this function.
command | unsigned integer | Specifies the HTML Help API command to execute in this function. You can pass the following values: HH_DISPLAY_TOPIC: Opens a compiled help (.chm) file and optionally displays a specific topic within the help file. The additionalData parameter is either NULL or a pointer to a topic (the name of the embedded html file containing the topic) within the compiled help file. Example: ShowHtmlHelp ("c:\\help.chm", HH_DISPLAY_TOPIC, NULL); HH_HELP_FINDER: Provides the same functionality as HH_HELP_TOPIC. This command is provided for backward compatibility with WinHelp, Example: ShowHtmlHelp ("c:\\help.chm", HH_HELPFINDER, NULL); HH_DISPLAY_TOC: Selects the Contents tab in the Navigation pane of the HTML Help Viewer. Pass NULL in the additionalData parameter. Example: ShowHtmlHelp ("c:\\help.chm", HH_DISPLAY_TOC, NULL); HH_DISPLAY_INDEX: Selects the Index tab in the Navigation pane of the HTML Help Viewer. Pass a string in the additionalData parameter to indicate the name of a keyword to select in the index. Pass NULL in the additionalData parameter to indicate that you do not want to select a keyword in the index. Example: ShowHtmlHelp ("c:\\cat.chm", HH_DISPLAY_INDEX, "meow"); HH_HELP_CONTEXT: Displays a help topic that you specify with a mapped topic ID. This is similar to the HELP_CONTEXT command in WinHelp. The topic IDs must be defined and mapped in the [MAP] section of the project (.hhp) file. Pass the context number of the topic in the additionalData parameter. Example: ShowHtmlHelp ("c:\\help.chm", HH_HELP_CONTEXT, (void *)5000); HH_CLOSE_ALL: Closes all HTML Help windows opened directly or indirectly by the calling program. You must pass NULL in the helpFile parameter. You must pass NULL in the additionalData parameter. Example: ShowHtmlHelp (NULL, HH_CLOSE_ALL, NULL);
additionalData | void * | Contains additional data to pass to the HTML Help API. The value you pass depends on the value you pass in the command parameter of this function. Refer to the help for the command parameter for more information and sample code.

## Return Value

Name | Type | Description
status | integer | Returns 0 if the function succeeds. Otherwise, returns a toolbox error code.