|Page Contents||Setting up a HTML-based help system Web pages for dialog boxes Contents Page Pop-up context help boxes Other web pages|
Using Hi HelpIndex and Hi Help in your product
The Hi HelpIndex Developer licence includes the necessary software to enable you to set up HTML-based help for your Windows Visual C++ MFC programs. This includes showing "What's This" style help in pop-up boxes. And the pop-up boxes can be shown from your help pages as well (as long as they are being viewed by Hi Help).
For an example of this, simply try Hi Lab. Make sure that you have Internet Explorer loaded.
The Hi HelpIndex help system often requires that users have more than 16MB in
Windows 95 or 98 systems. However, please check the memory requirements for your application.
Setting up a HTML-based help system
The main help engine is Hi Help.
This executable is provided as a part of Hi HelpIndex.
This has a defined interface which can be used from many development environments. However, tools and instructions are only available for Visual C++ MFC at the moment.
Contact our support desk for a copy of the necessary VC++ MFC source code. This intercepts the normal calls to WinHelp, and diverts them as necessary to Hi Help. If Internet Explorer is not loaded then it calls WinHelp as normal, so you should provide a basic ".hlp" file as a backup.
You still need to run the standard Microsoft MAKEHELP.BAT command to
build a ".hm" file for your project.
You must include this file in your release distribution;
this is how the help system knows which web page to load.
Include the following lines in MAKEHELP.BAT if you want pop-up help identifiers for controls.
echo // Controls (IDC_*) >>"hlp\YourApp.hm" makehm IDC_,HIDC_,0x50000 resource.h >>"hlp\YourApp.hm"
Please read Microsoft's VC++ Technical Note 28 on MFC Context-Sensitive Help Support.
Assuming you want to show pop-up help for the standard MFC ids,
DevStudio\VC\MFC\Include\AFXHELP.HM to the same directory
as your executable, and copy PHD's AfxHelp.htm
pop-up text to your help web page directory.
This is loaded automatically by Hi Help
once you have asked it to load your .hm file.
You may wish to customise AfxHelp.htm for your application.
Web pages for dialog boxes
For each resource in your project, you can write a help web page.
For example for a dialog IDD_OPTIONS you should write an HTML page
Hi Help always assumes a
.htm. file extension.
You can also write any number of other web pages to supplement the
basic resource pages. Just provide HTML links as normal.
You should also write a web page, eg called
which should call up Hi HelpIndex.
You tell Hi Help the name of this file.
Hi Help displays this page when its Contents button is pressed.
Once you have written all your help web pages,
make a suitable help index file for use by the Contents page.
Pop-up context help boxes
You will have other identifiers used in your project,
eg beginning with IDC_, IDM_ and IDS_.
These can be associated with full web pages, as described above,
or - more usefully - displayed as a small pop-up help box.
The are several ways in which context-sensitive help appears:
AfxMessageBox(IDS_BAD_OP);. If the user presses F1 while this message box is displayed, then context help for this id (actually HIDS_BAD_OP) is shown.
If your message contains parameters then use the following technique:
CString Msg; AfxFormatString1(Msg,IDS_BAD_OP,OpString); AfxMessageBox(Msg,MB_OK,IDS_BAD_OP);The %1 in the IDS_BAD_OP string is replaced by the string OpString. The longer call to AfxMessageBox() is necessary to ensure that it knows the help context id.
In a dialog's property sheet select either More Styles+Context Menu or Extended Styles+Context Help (these are equivalent). A small question mark will appear in the dialog title bar. Users click on this and select a control they want help on. You need to select each control's General+Help id. Do not forget to make the necessary alteration to MAKEHELP.BAT as described above.
Now, for each dialog you must intercept the WM_HELPINFO and WM_SYSCOMMAND as shown in our source code example. Use Class Wizard to intercept WM_HELPINFO and write OnHelpInfo(). You must intercept WM_SYSCOMMAND by hand and write OnSysCommand().
Note that you must not also enable a dialog's Maximise or Minimise boxes. In Windows 95/98/Me this makes the small question mark in the title bar disappear. In Windows NT/2000 the question mark appears, but generates the wrong message.
Controls without help ids (and those with id IDC_STATIC) generate a help context id of zero. OK and Cancel buttons generate a help context ids of 1 and 2 respectively. To catch these, from VC++'s View+Resource Symbols... add a new IDC_ symbols, say called IDC_NOTHING, IDC_OK and IDC_CANCEL, with values of 0, 1 and 2. Write some appropriate pop-up text, eg:
<A NAME="IDC_NOTHING"></A> Sorry, there is no description available for this. <HR> <A NAME="IDC_OK"></A> Press this button to complete the dialog box. <HR> <A NAME="IDC_CANCEL"></A> Press this button to cancel the dialog box. <HR>
You may be able to put this help support code in a generic dialog box class. Derive all your real dialogs from this base class.
The pop-up text for all these identifiers is put in one (or more) web pages. You tell Hi Help the name of this pop-up page.
The text for a particular identifier starts with an anchor tag and ends with a horizontal rule tag. For example, here is a pop-up for identifier IDC_ADD:
<A NAME="IDC_ADD"></A> Press the <B>Add</B> button to add an entry to the list.<P> This button may be disabled. <HR>And this is how it will appear.
Several HTML tags are supported.
You can define a pop-up for two identifiers at the same time by adding in an extra anchor name tag.
The BODY BGCOLOR and TEXT attributes determine the default background
and foreground text colours of the pop-up.
Set BASEFONT FACE and SIZE attributes before the
anchor to set the default font name and size.
Add a pop-up entry with an identifier name of
to specify the text that is shown when a matching id cannot be found.
The text has the id number and name appended.
<A NAME="Default"></A> Please contact PHD<P> Sorry, no help available for id <HR>
You can have links to pop-ups in your main web pages.
For example a link to the IDC_ADD add pop-up would be
<A HREF="popup:IDC_ADD">Add button</A>.
Hi Help will display the pop-up correctly.
Other web pages
Say you have a menu option Help+Welcome
which you want to display a web page.
Make this handler call
(You will need to include AfxPriv.h to reference HID_BASE_RESOURCE.)
From VC++'s View+Resource Symbols... add a new symbol called IDR_WELCOME,
say with value 50.
A suitable range of id values for such symbols is 50 to 99
as they do not conflict with any other ids defined.
IDR_WELCOME.htm and check it is displayed.
We plan to get rid of the need to have Internet Explorer loaded. If it is not there, then our own mini-web browser will display your help page as best it can.
We hope that the pop-up context help boxes will support images (GIF or perhaps just BMP) and hypertext links soon.