Opening help files by topic name or by Help ID
Dr.Explain is a useful help authoring tool for creating context sensitive help files.
The MS HTMLhelp API allows opening a specific topic within the CHM file from your software. Thus, with CHM file you can easily implement a context sensitive help functionality in your software application.
This sample code for Visual Basic demonstrates how to open a certain page of the help file:
Private Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" _
( ByVal hWndCaller As Long, _
ByVal pszFile As String, _
ByVal uCommand As Long, _
dwData As Any) As Long
Const HH_DISPLAY_TOPIC As Long = 0
Private Sub CommandF1_Click()
HtmlHelp hWnd, sPathToCHM, HH_DISPLAY_TOPIC, ByVal "topic_name.htm"
End Sub
... or by Help ID:
Private Sub CommandF1_Click()
HtmlHelp hWnd, sPathToCHM, HH_HELP_CONTEXT, ByVal 2000&
End Sub
This approach can be easily applied for other programming languages, e.g. for C\C++ application this may look like this:
void OnHelp()
{
HtmlHelp(hWnd, sPathToCHM, HH_DISPLAY_TOPIC, (DWORD)_T("topic_name.htm"));
};
... or by Help ID:
void OnHelp()
{
HtmlHelp(hWnd, sPathToCHM, HH_HELP_CONTEXT, (DWORD)2000);
};
Dr.Explain is a handy help authoring tool for creating context sensitive help files in CHM format.
|