Home WinHelp HTML Help MS Help 2.0 LongHorn Help Store Links Betas Projects  
 

HTML Help MFC Sample
Updated November 4, 2000

  Download Here (89k)

Note: This project also requires the header file htmlhelp.h, which is included with the HTML Help Workshop. Once you install the Workshop, the default location for this header file is:

c:\program files\html help workshop\include\

Thanks to Richard Protzel for pointing out this oversight!

This sample demonstrates using HTML Help with an MFC application. Developed with the AppWizard in VC++ 6.0, help support was not selected within the wizard due to its sole dependence on WinHelp techniques. The projects Include directories were modified to include htmlhelp.h in the HTML Help Workshop's Include folder, and htmlhelp.h has been added as an include file in MainFrm.cpp and Techniques.cpp. Linking to the Workshop's htmlhelp.lib file was included as well.

The main form, or document window, contains a menu that illustrates the following techniques:

  • Examples | CHM Popup: Creates a popup from a What's This topic text file within a compiled HTML Help file.

  • Examples | Resource Popup: Creates a popup from a string within a resource file.

  • Examples | Text Popup: Creates a popup from a text string within the application's code.

  • Examples | Set Window Type: Creates and displays a window using the HH_SET_WIN_TYPE API call.

  • Help | Contents: Opens a CHM to the Contents tab.

  • Help | Index: Opens a CHM to the Index tab.

  • Help | Search: Opens a CHM to the Search tab.

  • Help | Open Minus 'Jump To URL': Opens a CHM to the Contents tab while also deleting the 'Jump To URL' menu item from the system menu.

A dialog illustrating the following techniques is available by clicking the View | Techniques menu item on the main form:

  • What's This help: This dialog illustrates creating popup topics from a What's This topic text file within a compiled HTML Help file. However, any of the three popup techniques illustrated on the main form could be used.

  • Calling a topic via its context ID.

  • Calling a topic via its URL.

  • Calling a topic via a keyword.

  • Calling a topic via an ALink embedded within the topic.

It's important to note that the What's This help technique selects its own context ID's, which is extracted in Techniques.cpp as HELPINFO* pHelpInfo->dwContextId. Once a control's Help ID box is checked on its Properties dialog, run the application and subsequently run What's This help against the control to view a message containing the assigned ID for the control. Controls not having the Help ID boxed checked on its Properties dialog have a dwContextId of 0.