The wCommand can be one of the following constants:
HELP_COMMAND (Use WinHelpString)
Runs a Help macro or macro string.
strData: 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. You
must use the short form of the macro name for some macros because WinHelp does not support
the long name. For example, this will open the WinHelp engine and call the ExecProgram
macro, running calc.exe.:
WinHelpString hwnd, "C:WindowsCalc.hlp", _
HELP_COMMAND, "ExecProgram(""calc.exe"",0)"
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.
dwData: Ignored; set to 0.
For example, this would open up the contents topic as defined in the .hpj file.
However, there isn't one, so help just displays a default window:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_CONTENTS, 0
HELP_CONTEXT
Displays the topic identified by the specified context identifier defined in the [MAP]
section of the .HPJ file.
dwData: Long containing the context identifier for the topic.
For example, this will display a topic on changing the sign from the calculator help
file:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_CONTEXT, 80
HELP_CONTEXTPOPUP
Displays, in a pop-up window, the topic identified by the specified context identifier
defined in the [MAP] section of the .HPJ file.
dwData: Long containing the context identifier for a topic.
For example, this will display in a pop-up window the topic described in the above
example:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_CONTEXTPOPUP, 80
HELP_FINDER
Displays the Help Topics dialog box, selecting the previously selected tab. dwData:
Ignored; set to 0.
For example:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_FINDER, 0
HELP_FORCEFILE
Ensures that WinHelp is displaying the correct Help file. If the incorrect Help file is
being displayed, WinHelp opens the correct one; otherwise, there is no action.
dwdata: Ignored; set to 0.
For example:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_FORCEFILE, 0 'not quite sure
HELP_HELPONHELP
Displays Help on how to use WinHelp, if the WINHLP32.HLP file is available.
dwdata: Ignored; set to 0.
For example:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_HELPONHELP, 0
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.
dwdata: Ignored; set to 0.
For example:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_INDEX, 0
HELP_KEY (Use WinHelpString)
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.
strdata: A keyword string. Multiple keywords must be separated by semi-colons.
For example, this will show information about the binary button in the calculator help
file:
WinHelpString hwnd, "C:WindowsCalc.hlp", _
HELP_KEY, "Bin button"
HELP_PARTIALKEY (Use WinHelpString)
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 an empty
string.
strdata: A keyword string. Multiple keywords must be separated by semi-colons.
For example:
WinHelpString hwnd, "C:WindowsCalc.hlp", _
HELP_PARTIALKEY, "Bin Butto"
HELP_QUIT
Informs the WinHelp program that it is no longer needed. If no other programs have
asked for Help, Windows closes the WinHelp program.
dwdata: Ignored; set to 0.
For example:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_QUIT, 0
HELP_TAB
Opens the Help Topics dialog box, displaying the specified extensible tab. The first
tab is 0. If there are no extensible tabs available, then the contents tab will be
selected.
dwData: Zero-based index of the extensible tab to display (0 is the first tab, 1 the
second, etc.).
For example, this will display the contents tab of the calculator help file:
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_TAB, 0
HELP_SETCONTENTS
Specifies the Contents topic. The WinHelp program displays this topic when the user
clicks the Contents button if the Help file does not have an associated .CNT file. This is
not needed in Windows 95, but is included for backward compatibility.
dwdata: Long containing the context identifier for the Contents topic.
HELP_SETINDEX
Specifies the Index topic. The WinHelp program displays this topic when the user clicks
the Index button if the Help file does not have an associated .CNT file. This is not
needed in Windows 95, but is included for backward compatibility.
dwdata: Long containing the context identifier for the Index topic.
HELP_SETPOPUP_POS
Sets the position of the subsequent pop-up window.
dwdata: The position to display the pop-up window. The high word is the y-co-ordinate
and the low word is the x-co-ordinate.
For example:
Dim x As Integer, y As Integer
x = 300
y = 300
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_SETPOPUP_POS, y * 2 ^ 16 + x 'opens popup id
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_CONTEXTPOPUP, 80 'opens popup id
Next
HELP_SETWINPOS (Use WinHelpStruct)
Displays the Help window, if it is minimised or in memory, and sets its size and
position as specified.
udtdata: A HELPWININFO structure that specifies the size and position of either a
primary or secondary Help window.
For example, this will show the help window with our chosen dimensions:
Dim mywinpos As HELPWININFO
mywinpos.wStructSize = Len(mywinpos)
mywinpos.left = 10
mywinpos.top = 300
mywinpos.width = 300
mywinpos.height = 10
mywinpos.state = SW_SHOW
WinHelp hwnd, "C:WindowsCalc.hlp", _
HELP_CONTEXT, 80 'opens context id
WinHelpStruct hwnd, "C:WindowsCalc.hlp", _
HELP_SETWINPOS, mywinpos