by Gareth Lock (DynaByte Software) (3 Submissions)
Category: OLE/COM/DCOM/Active-X
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 23rd November 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Calling HTML Help (.CHM) files from within VB applications.
API Declarations
'Two function calls provided...
'HH_DISPLAY_Click() : Display help in response to a buton or menu click.
'HH_HELP_Click() : Display context sensitive help.
'Two variables required for both calls...
'ProgWindow : Your Program's Window Handle
'HelpFile : Filespec of the .CHM file to display.
Const HH_DISPLAY_TOPIC = &H0
Const HH_SET_WIN_TYPE = &H4
Const HH_GET_WIN_TYPE = &H5
Const HH_GET_WIN_HANDLE = &H6
Const HH_DISPLAY_TEXT_POPUP = &HE ' Display string resource ID or
' text in a pop-up window.
Const HH_HELP_CONTEXT = &HF ' Display mapped numeric value in
' dwData.
Const HH_TP_HELP_CONTEXTMENU = &H10 ' Text pop-up help, similar to
' WinHelp's HELP_CONTEXTMENU.
Const HH_TP_HELP_WM_HELP = &H11 ' text pop-up help, similar to
' WinHelp's HELP_WM_HELP.
Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal hwndCaller As Long, _
ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long
' hWnd is a Long defined elsewhere to be the window handle
' that will be the parent to the help window.
' The return value is the window handle of the created help window.
Public Function HH_DISPLAY_Click(ProgWindow As Long, HelpFile As String)
HH_DISPLAY_Click = HtmlHelp(ProgWindow, HelpFile, HH_DISPLAY_TOPIC, 0)
End Function
' A specific topic identified by the variable ContextID is launched
' in response to this button click:
' The return value is the window handle of the created help window.
Public Function HH_HELP_Click(ProgWindow As Long, HelpFile As String)
HH_HELP_Click = HtmlHelp(ProgWindow, HelpFile, HH_HELP_CONTEXT, ContextID)
End Function