Click here to Skip to main content
15,891,136 members
Articles / Desktop Programming / MFC
Article

Generate Help Macro File Tool

Rate me:
Please Sign up or sign in to vote.
3.67/5 (2 votes)
26 Jul 2000 48.4K   469   23   1
A tool to generate help macro files for your VC++ project.
  • Download Tool and Example - 106 Kb
  • Program Screen Shot

    Introduction

    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: "CGMAKEHM $(ProjDir)\Resource.H" Then enter the following text into the Output File field to the right: "$(ProjDir)\ProjectName.Hm" 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:

    Project Settings Screen Shot

    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:

    /////////////////////////////////////////////////////////////////////////////
    // Context sensitive help support (see Technical note TN028 for more details)
    
    // Help ID bases
    #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:

    [DefinitionsExcluded]
    E0001=IDC_ABOUT_ICON
    E0002=IDC_ABOUT_SPRODUCT
    E0003=IDC_ABOUT_SVERSION
    E0004=IDC_ABOUT_SCOPYRIGHT
    E0005=IDC_ABOUT_SDISTRIBUTEDBY
    E0006=IDC_ABOUT_SREGOWNER
    E0007=IDC_ABOUT_SREGORG
    E0008=IDC_ABOUT_SSYSINFOMEM
    E0009=IDC_ABOUT_SSYSINFODISK
    E0010=IDC_SFRM001
    E0011=IDC_SFRM000
    E0012=IDC_ABOUT_SDETAILNAME
    E0013=IDC_ABOUT_SDETAILTYPE
    E0014=IDC_ABOUT_SDETAILVERSION
    E0015=IDC_ABOUT_SDETAILFLAGS
    E0016=IDC_ABOUT_SDETAILDESC
    E0017=IDC_ABOUT_SDETAILCOMMENT
    E0018=IDC_ABOUT_SDETAILPRODNAME
    E0019=IDC_ABOUT_SDETAILPRODVER
    E0020=IDR_MAINFRAME
    
    [DefinitionsExtra]
    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.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    Web Developer
    United States United States
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralCommand Line Use Pin
    gjr17-Aug-04 19:20
    gjr17-Aug-04 19:20 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.