[译]生成帮助宏文件工具
By robot-v1.0
本文链接 https://www.kyfws.com/applications/generate-help-macro-file-tool-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 4 分钟阅读 - 1644 个词 阅读量 0[译]生成帮助宏文件工具
原文地址:https://www.codeproject.com/Articles/650/Generate-Help-Macro-File-Tool
原文作者:Blake V. Miller
译文由本站 robot-v1.0 翻译
前言
A tool to generate help macro files for your VC++ project.
一种为VC ++项目生成帮助宏文件的工具.
介绍(Introduction)
如果您按此处所述编辑项目设置,该程序将从MFC项目中读取Resource.H文件并自动生成" ProjectName" .Hm帮助宏文件.(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.)
您可以在项目中添加自定义生成步骤,以在每次生成可执行文件时创建帮助宏文件,但是在尝试在生成过程中使用CGMAKEHM.EXE之前,应确保它在路径中.我将我的文件复制到安装Visual C ++的BIN文件夹中.(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.)
打开项目设置,然后选择Resource.H文件.从下拉组合框中选择发布.然后在右侧的"构建命令"字段中输入以下文本:" CGMAKEHM $(ProjDir)\ Resource.H"然后在右侧的"输出文件"字段中输入以下文本:" $ (ProjDir)\ ProjectName.Hm",其中" ProjectName"是项目的名称,或您要调用帮助宏文件的任何其他有效文件名.(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:)
将其添加到项目设置中肯定比手动添加所需的所有典型MakeHm调用更容易!(Adding this to your project settings is certainly easier to do than to manually add all the typical MakeHm calls required!)
该程序的优点是它将读取文件ProjectName.Hms并将其解析为要排除的项目以及要包含在Resource.H中的其他项目.该文件的布局与初始化文件完全一样. [DefinitionsExcluded]部分指示要排除的标识符,[DefinitionsExtra]部分指示添加的行完全相同,就像它们来自另一个头文件一样.该程序不处理Resource.H中可能包含的任何包含文件行.(The advantage of this program is that it will read the file ProjectName.Hms and parse it for items to be excluded andalso 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.)
程序处理标准标识符前缀:ID_,IDC_,IDD_,IDM_,IDP_,IDR_和IDW_.它还将处理IDV_和IDE_标识符,并应用与IDP_标识符相同的偏移量.您可以在AfxPriv.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.*)
这是AfxPriv.H头文件中的相关代码段:(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
我已经使用RoboHelp 7.0测试了帮助宏文件,并且它完美地集成在一起,使您可以轻松地为每个上下文相关的帮助主题选择主题标识符.(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.)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
C++ VC6 Windows Win2K MFC Visual-Studio Dev 新闻 翻译