Providing online Help for users

Two ways to call Help from an application

PowerBuilder provides two principal ways of calling an online Help file from a PowerBuilder application:

Using ShowHelp

ShowHelp is simpler to implement than the WinHelp API. You can use the ShowHelp PowerScript function to search for Help topics by Help context ID, by keyword, and by accessing the Help file Contents topic (the topic defined in the project file as the Help Contents topic). ShowHelp can also be used with compiled HTML (.chm) files.

ShowPopupHelp displays pop-up help for a control. Typically, you use ShowPopupHelp in the Help event of a response window with the Context Help property enabled. Events relating to movement of the cursor over a control or to the dragging of a control or object are also logical places for a ShowPopupHelp call.

For more information on the ShowHelp and ShowPopupHelp functions as well as the Help event, see the PowerScript Reference.

Using the WinHelp API

Declaring and using the WinHelp API allows access to the full range of WinHelp functions, many of which are not available in ShowHelp. For example, using the WinHelp function, you can easily specify a window type or window name in which to present a Help topic.

StepsTo declare the WinHelp API as an external function:

  1. Select Declare>Global External Functions from the menu bar of any painter that accesses the Script view.

  2. Enter the function declaration in the text box and click OK.

    This example declares the WinHelp API:

    FUNCTION boolean WinHelpA(long hWndMain, &
    
    			string lpszHelp, long uCommand, &
    
    			long dwData) &
    
    LIBRARY "USER32.DLL"
    

For more information about the WinHelp API, see the online Help for the Microsoft Help Workshop or the documentation for your Help authoring tool. For more information about declaring and using global external functions, see the PowerScript Reference and “Using external functions”.