Download Tool and Example - 106 Kb
This program will read the Resource.H file from an MFC project and automatically
generate the 'ProjectName'.Hm help macro file, if you edit the project settings as described here.
You can add a custom build step to your project to create the help macro file each time your
executable is built, but you should make sure that CGMAKEHM.EXE is somewhere in your path
before trying to use it in the build process. I copy mine to the BIN folder where
Visual C++ is installed.
Open the project settings, then select the Resource.H file. Select Release from the drop down combo box.
Then enter the following text into the Build Commands field to the right:
Then enter the following text into the Output File field to the right:
where 'ProjectName' is the name of the project, or any other valid file name you want the help macro file to be called.
Here is a screen shot of the project settings dialog for one of my projects:
Adding this to your project settings is certainly easier to do than to manually add all the typical MakeHm calls required!
The advantage of this program is that it will read the file ProjectName.Hms and parse it for items to be excluded and
also for items to be included that are not otherwise in Resource.H. The layout of this file is exactly like an Initialization
file. The [DefinitionsExcluded] section indicates identifiers to be excluded, and the [DefinitionsExtra] section indicates addition
of lines exactly as if they were from another header file. The program does not process any include file lines
that might be found in Resource.H.
The program processes the standard identifier prefixes: ID_, IDC_, IDD_, IDM_, IDP_, IDR_, and IDW_. It
will also process the IDV_ and IDE_ identifers and apply the same offset as for the IDP_ identifier.
You can look into the AfxPriv.H file for the offsets applied to each identifier.
Here is the relevant snippet from the AfxPriv.H header file:
#define HID_BASE_COMMAND 0x00010000UL // ID and IDM
#define HID_BASE_RESOURCE 0x00020000UL // IDR and IDD
#define HID_BASE_PROMPT 0x00030000UL // IDP
#define HID_BASE_NCAREAS 0x00040000UL
#define HID_BASE_CONTROL 0x00050000UL // IDC
#define HID_BASE_DISPATCH 0x00060000UL // IDispatch help codes
Here is an example Help Macro Settings file:
E0001=#define IDM_ABOUTBOX 0x0010 // about box
E0002=#define IDM_TECHSUPT 0x0020 // technical support
E0003=#define IDM_WEBPAGES 0x0030 // goto web pages
E0004=#define IDM_SCMOVE 0xF010 // move system menu
E0005=#define IDM_SCCLOSE 0xF060 // close system menu
I have tested the help macro files with RoboHelp 7.0 and it integrates perfectly, making it
very simple to select the topic identifiers for each of your context sensitive help topics.
If you should choose to run it manually, you will see the main dialog, and then you can select the three
required files and view the output file once it has been generated.