Zum Inhalt


After you have created an HTML Help (CHM) file, you will probably want to integrate it with your application and provide context-sensitive Help. Below are code examples that demonstrate how to connect a CHM help file with a programming language or IDE.

Working with a CHM File from a VBA Application

Please note that in a VBA application we use HTML Help API calls directly.

Declare the Following Constants:

Public Const HH_DISPLAY_TOPIC = &H0
Public Const HH_DISPLAY_TOC = &H1
Public Const HH_DISPLAY_INDEX = &H2
Public Const HH_HELP_CONTEXT = &HF

Declare the HTMLHelp() API function:

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

Call a help topic by Context Id:

HTMLHelp 0, MyHelpFile, HH_HELP_CONTEXT, MyTopicContextID

Show the Table of Contents:

HTMLHelp 0, MyHelpFile, HH_DISPLAY_TOC, 0