INTEGRATING INTO YOUR APPLICATIONS
More about Help Explorer Viewer
Help Explorer Viewer can be integrated into any Windows or Linux
application no matter what language and environment the
application was created in. Integration means that your
applications will call Help Explorer Viewer as a viewer for the
help files that document the applications' functionality.
To integrate Help Explorer Viewer into your application, use the
contents of the Help Explorer Viewer integration package, which
includes all necessary modules and permissions. After
installation, uncompress its contents to an
appropriate directory. The libraries
libhelpexplapi.so (in the Linux package)
or helpexplapi.dll (in the Windows
package) implement the interface between
your applications and the help system provided by
Help Explorer Viewer. The Help Explorer Viewer API is fully compatible with
the WinHelp API.

Help Explorer Viewer API
The InvokeHelp function starts Help Explorer
Viewer and passes it additional data indicating the nature of the
help requested by the application. InvokeHelp
closely resembles Windows' WinHelp function:
BOOL InvokeHelp(
uint hWnd,
LPCTSTR lpszHelpFile,
uint fuCommand,
void* dwData
);
| Parameter |
Description |
hWnd |
Handle of the window requesting Help. The
InvokeHelp function uses this handle to
keep track of which programs have requested Help. If
fuCommand specifies
HELP_CONTEXTMENU or
HELP_WM_HELP, hWnd identifies
the control requesting Help. |
lpszHelpFile |
Address of a null-terminated string containing the
path, if necessary, and the name of the Help file that
HelpExplorer is to display. The filename may be
followed by an angle bracket (>) and the name of a
secondary window if the topic is to be displayed in a
secondary window rather than in the primary window. |
fuCommand |
Type of help requested. For a list of possible values
and how they affect the value to place in the
dwData parameter, see below. |
dwData |
Additional data. The value used depends on the value of
the fuCommand parameter. For a list of
possible values, see below. |

Return Value
If successful, the return value is TRUE. Otherwise, it is
FALSE.
Comments
lpszHelpFile parameter specifies the name and, where required, the
directory path of the Help file to display. Before closing
the window that requested Help, the application should call
InvokeHelp with the fuCommand
parameter set to HELP_QUIT. Until all applications
have done this, Help Explorer Viewer process remains in the system.
Note: calling InvokeHelp with the
HELP_QUIT command is not necessary if you used
the HELP_CONTEXTPOPUP command to start Help.
The following table shows the possible values for the
fuCommand parameter and the corresponding
formats of the dwData parameter:
| fuCommand |
Action |
dwData |
HELP_COMMAND |
Runs a Help macro or macro string. |
Address of a string that specifies the name of the Help
macro(s) to run. If the string specifies multiple macro
names, the names must be separated by colons or
semicolons. The short form of the macro
name is preferred. |
HELP_CONTENTS |
Displays the topic specified by the Contents option in
the [OPTIONS] section of the .HPJ file. This command is
for backward compatibility. New programs should provide
a .CNT file and use the HELP_FINDER command. |
Ignored. |
HELP_CONTEXT |
Displays the topic identified by the specified context
identifier defined in the [MAP] section of the .HPJ
file. |
Unsigned long integer containing the context identifier
for the topic. |
HELP_CONTEXTMENU |
Displays the Help menu for the selected window, and
then displays (in a popup window) the topic for the
selected control. |
Address of an array of double word pairs. The first
double word in each pair is a control identifier, and
the second is a context number for a topic. |
HELP_CONTEXTPOPUP |
Displays, in a popup window, the topic identified by
the specified context identifier defined in the [MAP]
section of the .HPJ file. |
Unsigned long integer containing the context identifier
for a topic. |
HELP_FINDER |
Displays the Help Topics dialog box. |
Ignored. |
HELP_FORCEFILE |
Ensures that Help Explorer Viewer is displaying the correct
Help file. If the incorrect Help file is being
displayed, HelpExplorer opens the correct one.
Otherwise, there is no action. |
Ignored. |
HELP_HELPONHELP |
Displays Help on how to use Help Explorer Viewer, if the
HelpExpl.HLP file is available. |
Ignored. |
HELP_INDEX |
Displays the topic specified by the CONTENTS option in
the [OPTIONS] section of the .HPJ file. This command is
for backward compatibility. New programs should provide
a .CNT file and use the HELP_FINDER
command. |
Ignored. |
HELP_KEY |
Displays the topic in the keyword table that matches
the specified keyword, if there is an exact match. If
there is more than one match, this command displays the
Topics Found list box. |
Address of a keyword string. Multiple keywords must be
separated by semi-colons. |
HELP_MULTIKEY |
Displays the topic specified by a keyword in an
alternative keyword table. |
Address of a MULTIKEYHELP structure that specifies a table footnote character and
a keyword. |
HELP_PARTIALKEY |
Displays the topic in the keyword table that matches
the specified keyword if there is an exact match. If
there is more than one match, this command displays the
Topics Found dialog box. To display the Index without
passing a keyword, you should use a pointer to an empty
string. |
Address of a keyword string. Multiple keywords must be
separated by semi-colons. |
HELP_QUIT |
Informs the HelpExplorer program that it is no longer
needed. If no other programs have asked for Help,
Windows closes Help Explorer Viewer. |
Ignored. |
HELP_SETCONTENTS |
Specifies the Contents topic. Help Explorer Viewer
displays this topic when the user clicks the Contents
button if the Help file does not have an associated
.CNT file. |
Unsigned long integer containing the context identifier
for the Contents topic. |
HELP_SETPOPUP_POS |
Sets the position of the subsequent popup window. |
Contains the position data. Use the
MakeLong macro to concatenate the
horizontal and vertical coordinates into a single
value. The popup window is positioned as if the mouse
cursor were at the specified point when the popup
window was invoked. |
HELP_SETWINPOS |
Displays the Help window, if it is minimized or in
memory, and sets its size and position as specified. |
Address of a HELPWININFO
structure that specifies the size and position of
either a primary or secondary Help window. |
HELP_TCARD |
Indicates that a command is for a training card
instance of the HelpExplorer program. A program
combines the HELP_TCARD flag with other
commands by using the bitwise OR operator. |
Depends on the command with which the flag is combined. |
HELP_WM_HELP |
Displays, in a popup window, the topic for the control
identified by hWnd. |
Address of an array of double word pairs. The first
double word in each pair is a control identifier, and
the second is a context identifier for a topic. |
HELP_TAB |
Opens the Help Topics dialog box, displaying the
specified extensible tab. |
Zero-based index of the extensible tab to display (0 is
the first tab, 1 the second, etc.). |

For example, to provide a Help menu command that invokes the application help, use the following syntax:
InvokeHelp(handle, "myapp.chm", HELP_FINDER, 0)
Resolving Compatibility Issues
When viewing files in Windows Help format in Help Explorer Viewer under Windows and Linux, you may encounter the following common problems that concern compatibility between these operating systems.
Case-sensitive file names in Linux
Linux file systems are case-sensitive, while Windows file
systems are case-insensitive. So, if you want to view a
help file under Linux, it is very important to ensure that
links to external files in the help project are given in
the same case as the actual files stored on disk have.
If you are going to use third-party help files without
recompiling them, you will not be able to ensure such
correspondence. To solve this problem for such files, use
the file aliasing mechanism supported by
Help Explorer Viewer. It means that for each actual file name,
which might be valid under Windows and invalid under Linux,
you can specify one or several alias file names which will
be definitely valid under Linux.
To use the file aliasing, create the [Setup/File Aliases]
section in Help Explorer Viewer's configuration file
.helpexplorerc and populate the alias list in the
following way:
Real-File-Name=Alias-File-Name[;
Alias-File-Name]
For example:
WinHelp32.hlp=winhelp32.hlp
MyHelp.HLP=MYHELP.HLP
MyApplication=myappV1.hlp;myappV2.chm;myappV3.hxs
The following
rule applies: if a file with a real name is not found,
Help Explorer Viewer tries to open the file by its alias. If
there are several aliases specified for a file,
Help Explorer Viewer will search for the file in the order its
aliases are given (from left to the right) until the file
is found.
Missed fonts
This problem is related to a situation when fonts specified
in a help file do not exist in the operating system under
which you are viewing this help file. This situation can
occur not only under Linux, but also under Windows.
To solve this problem, use the font aliasing
mechanism supported by Help Explorer Viewer. This mechanism enables
substitution of a font announced in the help file with any
other font installed in the target operating system without
recompiling the help file.
To use the font aliasing, create the [Setup/Font Aliases] section in Help Explorer Viewer's configuration file
.helpexplorerc. In this section, specify what
fonts that reside in your operating system are to be used
instead of the ones announced in help files. The format of
each line is
Key=Value,
-
where
Key is a font specified in the help
and Value is a font that will replace it.
For example:
Helvetica=Fixed
Verdana=Fixed
|