About   -   Contact   -   Purchase   -   Search   -   What's New

Windows Help Tricks
The function ShowHelp provided by PowerBuilder allows you access to the basic elements of a help file. Under Windows 3.1 this was great but things have moved on a bit since then and unfortunately the command has not been updated to keep pace with the newer help engine in Windows 95 and Windows NT 4.

There are two new features in particular that would be useful. The first is to access the new contents tab in the help dialog. With the ShowHelp function you can make PowerBuilder open the index tab with the following command:

ShowHelp( 'pbbdrtray.hlp', KeyWord!, '' )

But access to the first tab looks much more professional.

Secondly you can make the help engine display a help page as a small popup window. If you use a standard OS dialog and use the little ? icon you will see a small popup help dialog. This is a standard feature of the help engine.

The API call to perform these functions is called WinHelp, so to make PowerBuilder perform these functions we need to declare the API call:

function long WinHelpA(ulong hwind, string lpszHelp, uint uCommand, ulong dwData) library "user32"

Note we need to specify the A for ASCII on the API call to tell windows we are calling the function with ASCII strings and not Unicode strings.

Then we need to declare the argument values to the functions, by looking in the .h file associated with the command you want you can find out what the values of the arguments to the functions should be. We need to declare the arguments as such:

integer HELP_CONTEXT = 1
integer HELP_CONTENTS = 3
integer HELP_FINDER = 11

We can then make calls to the API function to perform the tasks that we want. The first function will open the 3 tab dialog with the first tab showing.

WinHelp( 0, , HELP_FINDER, 0 )

This next function will display a help popup for a given help topic.


These functions and a few others for accessing the WinHelp engine are built into a small object and available for download from the Software Page.


Top of Page

Legal Notice

Ken Howe 2011