Show Sitemap ..Help2HTMLHelpWinHelp

Creating Context-Sensitive Help for Applications

Context-sensitive help sometimes seems to be a bit difficult so I made an example project available for free download. Notice the section "Download" in the table of contents for Visual Basic 6 and further Links to context sensitive help on this page.

Source for the HTMLHelp project file

Open your .hhp file in a text editor and add the sections ALIAS and MAP to the HTMLHelp project file and add the files to your help project:


[OPTIONS]
Auto Index=Yes
...


[WINDOWS]
main="Online Help","CHM-example.hhc",...
wndTopic="New Topic Window","CHM-example.hhc", ...

[FILES]
design.css
index.htm
Context-sensitive_example\contextID-10000.htm
Context-sensitive_example\contextID-10010.htm
Context-sensitive_example\contextID-20000.htm
Context-sensitive_example\contextID-20010.htm
Garden\flowers.htm
Garden\garden.htm
Garden\tree.htm
HTMLHelp_Examples\CloseWindowAutomatically.htm
HTMLHelp_Examples\Jump_to_anchor.htm
HTMLHelp_Examples\shortcut_link.htm
HTMLHelp_Examples\Simple_link_example.htm
images\blume.jpg
...

[ALIAS]
#include alias.h

[MAP]
#include map.h
#include topic.h

[TEXT POPUPS]
topic.h
topic.txt

[INFOTYPES]

 

ALIAS and MAP files

The purpose of the two files is to ease the coordination between developer and help author. The mapping file links an ID to the map number - typically this can be easily created by the developer and passed to the help author. Then the help author creates an alias file linking the IDs to the topic names.

ALIAS file

In a text editor enter the ALIAS details like IDH_90000=index.htm. Save the file as 'alias.h' in same folder as your help project file.

;----------------------------------------
; alias.h file example for HTMLHelp (CHM)
; www.help-info.de
;
; All IDH's > 10000 for better format
; last edited: 2006-07-09
;----------------------------------------
IDH_90000=index.htm
IDH_10000=Context-sensitive_example\contextID-10000.htm
IDH_10010=Context-sensitive_example\contextID-10010.htm
IDH_20000=Context-sensitive_example\contextID-20000.htm
IDH_20010=Context-sensitive_example\contextID-20010.htm

Multiple map numbers in a topic (see below too):

HTMLHelp will certainly let you assign multiple map IDs to one topic, e.g.

IDH50000_0=myfile_1.htm
IDH50000_1=myfile_1.htm
IDH50000_2=myfile_1.htm

Anchor in the middle of the topic (see below too):

If you would like to jump from your program to an anchor in the middle of a topic you have to add e.g. following line to your alias.h file:

IDH_30000=HTMLHelp_Examples\jump_to_anchor.htm#AnchorSample

But you'll get e.g. the following error message:
HHC3015: Warning: An alias has been created to "HTMLHelp_Examples\jump_to_anchor.htm#AnchorSample" but the file does not exist
The KeyTools Error Message Reference (http://www.workwrite.com/helpthink/errors_zubak.htm) says that you can safely ignore this error message - the link should still work. If it bothers you, though, you can suppress the message by changing your aliases to, for example:

IDH_30000=CHM-example.chm::/HTMLHelp_Examples\jump_to_anchor.htm#AnchorSample

But note - this means renaming the CHM will break the alias!

MAP file

In a text editor enter the MAP details like #define IDH_90000 90000;frmMain. Save the file as 'map.h' in same folder as your help project file.

;--------------------------------------
; map.h file example for HTMLHelp (CHM)
; www.help-info.de
;
; All IDH's > 10000 for better format
; ;comment at end of line
;--------------------------------------
#define IDH_90000 90000;frmMain
#define IDH_10000 10000;frmAddressDataContextID-1
#define IDH_10010 10010;frmAddressDataContextID-2
#define IDH_20000 20000;frmAddressDataContextID-3
#define IDH_20010 20010;frmAddressDataContextID-4

Multiple map numbers in a topic:

HTMLHelp will certainly let you assign multiple map IDs to one topic, e.g.

#define IDH50000_0 50000;comment-0 
#define IDH50000_1 50001;comment-1
#define IDH50000_2 50002;comment-2

Anchor in the middle of the topic:

If you would like to jump from your program to an anchor in the middle of a topic (see above) you have to add e.g. following line to your map.h file:

#define IDH_30000 30000;frmAddressDataContextID-5

Recompile your .HHP file. Now your application can call help using context help ID's instead of topic file names.

Topic-ID and Topic-Text for "What's this? Help

topic.h

;-------------------------------------------------------------
; topic.h file example for HTMLHelp (CHM)
; www.help-info.de
;
; All IDH's < 10000 to avoid same ID in map.h
; This is a mapping of "What's this?" or F1 PopUp help for VB6
; ;comment at end of line
;-------------------------------------------------------------
#define IDH_900 900;nohelp
#define IDH_100 100;PopUp_AddressData_btnOK
#define IDH_110 110;PopUp_AddressData_txtFirstName
#define IDH_120 120;PopUp_AddressData_txtLastName

topic.txt

;-------------------------------------------------
; topic.txt file example for HTMLHelp (CHM)
; www.help-info.de
;
;
; This is a file including the ID and PopUp text
;-------------------------------------------------
.topic IDH_900
Sorry, no help available!

.topic IDH_100
This is context sensitive help text for a button (ID: IDH_100).

.topic IDH_110
This is context sensitive help text for a text box (ID: IDH_110).

.topic IDH_120
This is context sensitive help text for a text box (ID: IDH_120).

 

Links to context sensitive help

 

 


Top ...