在主chm文件窗口中的合并的chm文件中打开主题 [英] open topic in merged chm file in master chm file window

查看:174
本文介绍了在主chm文件窗口中的合并的chm文件中打开主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在主chm文件窗口中的合并的chm文件中打开主题. 我有应用程序帮助的主要chm文件.因此,此主chm文件包括子chm文件.我想通过调用htmlhelp函数在主chm文件的窗口中的子(合并)chm文件中打开主题.

以下是主chm项目中的头文件,而operation \ ACORD_geometry.chm是合并的chm文件.现在,我正在使用Adobe robohelp.

[ALIAS]
  IDH_operation_geometry=operation\ACORD_geometry.chm:\HID_geometrytab_functions.htm

[MAP]
  #define IDH_operation_geometry    9001

然后通过以下方式调用htmlhelp函数.但是该主题没有打开. .\ help \ 3DFEMGeo.chm是主要的chm文件.

HtmlHelp(Application.Handle, '.\help\3DFEMGeo.chm', HH_HELP_CONTEXT, 9001);

请教我如何在子chm中打开主题.

解决方案

通过合并多个帮助项目的索引和目录,可以创建模块化帮助系统,但在某些情况下很难克服.以下说明的某些部分已由Sean Stagmer于多年前发布.要获得上下文相关的帮助,请参阅底部的内容和链接:

http://www.help-info.de/zh-CN/Help_Info_HTMLHelp/hh_context-id.htm

长话短说(HTH-请尝试满足您的需求和环境):

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET

故事的长版:

RoboHelp,例如和许多其他帮助创作工具(HAT)是用于利用Microsoft HTML帮助编译器(hhw.exe)的IDE前端. RoboHelp的较早版本的设计者在分离构建HTML编译的帮助文件的技术方面做得很好,但是如果直接使用基础工具,则会遗漏一些可用的功能. 特别是模块化帮助.我认为研究此主题的大多数人都学会了将以下内容添加到他们的帮助项目文件(.hhp)中,以开始设计模块化HTML帮助系统:

// *** BEGIN CODE SNIPPET
[MERGE FILES]
SubHelpSubject1.chm
SubHelpSubject2.chm
...
// *** END CODE SNIPPET

现在,在模块化设计中处理上下文相关帮助和合并文件这一主题增加了新的变化:如何将主题ID映射到适当的合并HTML文件?由于是模块化的,主题ID不在主/主机帮助文件中,而是通过合并的子帮助项目的.chm文件集成到其中.这是通过将以下代码放入主/主机主的TOC文件中来完成的:

// *** BEGIN CODE SNIPPET
...
<LI>
<OBJECT type="text/sitemap">
  <param name="Name" value="SubHelpSubject1">
</OBJECT>
<OBJECT type="text/sitemap">
  <param name="Merge" value="SubHelpSubject1.chm::\SubHelpSubject1.hhc">
</OBJECT>
<LI>
<OBJECT type="text/sitemap">
  <param name="Name" value="SubHelpSubject2">
</OBJECT>
<OBJECT type="text/sitemap">
  <param name="Merge" value="SubHelpSubject2.chm::\SubHelpSubject2.hhc">
</OBJECT>
...
// *** END CODE SNIPPET

有了这两个添加项(MERGE FILES语句和TOC文件的添加项),就可以完成对主题ID对其帮助主题信息的正确解析,除非您注意到HTML帮助窗口仅显示该子项的TOC -help项目将其映射到!主/主机目录根本不显示.有什么作用?

答案在于主项目/宿主项目的别名文件.作为优秀的HTML帮助内容开发人员,您知道如何通过修改简单的别名语法将感兴趣的主题ID映射到适当的子帮助文件:

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1=Topic_1.htm
HID_TOPIC_ID2=Topic_2.htm
...
// *** END CODE SNIPPET

...对此:

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET

"ms-its:"这个小东西很像您在网络浏览器中键入的"http:"或"ftp:"文本:它被Microsoft称为异步可插入协议".它的'::/'部分是参考;用C ++的说法是一种间接级别"或引用别名".因此,要解决将上下文相关的帮助主题都映射到正确的帮助主题html文本并使TOC与主对象保持同步的问题,必须添加一个附加级别的间接操作才能使其起作用,如下所示:

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET

这可以理解为:显示帮助主题HID_TOPIC_ID1信息时,打开Master.chm,然后导航到SubHelpSubject1.chm的HTML文件Topic_1.htm,然后将页面向下移动到书签Topic1."

万岁!弹出您的主题,并且主/主机目录也可见!

就像用C ++术语思考一样,别名文件看起来非常像我们在C ++类中引用功能的方式:

Result = BaseClass::SubClass1::Subclass2::DoFunctionCall();

请注意,此语法已被XML取代-HTML帮助将引用集合文件(.col)中指定的集合",该文件中包含XML条目.比起别名文件中那种晦涩的类似于PERL的语法,它更容易阅读和遵循.

I would like to open topic in merged chm file in master chm file windows. I have main chm file of application help. So this main chm file includes sub chm file. And I would like to open the topic in sub (merged) chm file in the window of main chm file by calling htmlhelp function.

The following is header file in main chm project.And operation\ACORD_geometry.chm is merged chm file. Now I'm using Adobe robohelp.

[ALIAS]
  IDH_operation_geometry=operation\ACORD_geometry.chm:\HID_geometrytab_functions.htm

[MAP]
  #define IDH_operation_geometry    9001

And I call htmlhelp function by following way. But The topic don't open. .\help\3DFEMGeo.chm is main chm file.

HtmlHelp(Application.Handle, '.\help\3DFEMGeo.chm', HH_HELP_CONTEXT, 9001);

Please teach me the way to open topic in the sub chm.

解决方案

Creating modular help systems has some benefits by merging indexes and TOCs of multiple help projects, but overcoming the wall is difficult some times. Some parts of the following instructions have been posted many years ago by Sean Stagmer. For context-sensitive help see also content and links at the bottom:

http://www.help-info.de/en/Help_Info_HTMLHelp/hh_context-id.htm

Long story short (HTH - please try for your needs and environment):

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET

And the stories long version:

RoboHelp e.g. and many other Help Authoring Tools (HAT's) are a IDE front end for utilizing the Microsoft HTML Help compiler (hhw.exe). The designers of RoboHelp's older versions did a pretty good job of separating the technical aspects of building an HTML compiled help file, but left out several features available if you used the underlying tool directly. Specifically, modular help. I assume that most people who investigated this topic learned about adding the following to their help project file (the .hhp) to begin designing a modular HTML help system:

// *** BEGIN CODE SNIPPET
[MERGE FILES]
SubHelpSubject1.chm
SubHelpSubject2.chm
...
// *** END CODE SNIPPET

Now, tackling the subject of context-sensitive help AND merged files in a modular design adds a new twist: How can the topic ID be mapped to the appropriate merged HTML file? Being modular, the topic ID is not in the master/host help file, but is instead integrated into it through the merged sub-help project's .chm file. This is accomplished by placing the following code in the master/host master's TOC file:

// *** BEGIN CODE SNIPPET
...
<LI>
<OBJECT type="text/sitemap">
  <param name="Name" value="SubHelpSubject1">
</OBJECT>
<OBJECT type="text/sitemap">
  <param name="Merge" value="SubHelpSubject1.chm::\SubHelpSubject1.hhc">
</OBJECT>
<LI>
<OBJECT type="text/sitemap">
  <param name="Name" value="SubHelpSubject2">
</OBJECT>
<OBJECT type="text/sitemap">
  <param name="Merge" value="SubHelpSubject2.chm::\SubHelpSubject2.hhc">
</OBJECT>
...
// *** END CODE SNIPPET

With these two additions (the MERGE FILES statement and the addition to the TOC file) the correct resolving of topic id's to their help topic information is complete, EXCEPT that you notice that the HTML help window shows ONLY the TOC for the sub-help project it mapped to! The master/host TOC doesn't show up at all. What gives?

The answer lies in the alias file for the master/host project. Being a good little HTML help content developer, you knew to map the topic id of interest to the appropriate sub-help file by modifying the simple alias syntax like this:

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1=Topic_1.htm
HID_TOPIC_ID2=Topic_2.htm
...
// *** END CODE SNIPPET

...to this:

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET

That little 'ms-its:' thing is very much like the 'http:' or 'ftp:' text you type into a web browser: it's known as an Asynchronous Pluggable Protocol from Microsoft. The '::/' portion of it is a reference; a kind of 'level of indirection' or 'reference alias' in C++ parlance. So, to solve the problem of having the context-sensitive help topic BOTH map to the correct help topic html text AND keep the TOC synchronized with the master, you must add an additional level of indirection to make it work, as shown below:

// *** BEGIN CODE SNIPPET
...
HID_TOPIC_ID1="ms-its:Master.chm::/SubHelpSubject1.chm::/Topic_1.htm#Topic1"
HID_TOPIC_ID2="ms-its:Master.chm::/SubHelpSubject2.chm::/Topic_2.htm#Topic2"
...
// *** END CODE SNIPPET

This can be read as meaning this: "When displaying the help topic HID_TOPIC_ID1 information, open Master.chm, then navigate to SubHelpSubject1.chm's HTML file Topic_1.htm, then move down the page to the bookmark Topic1."

Hooray! Your topic pops up, and the master/host TOC is visible as well!

Like thinking in C++ terms the alias file looks very much like how we would reference functionality in a C++ class:

Result = BaseClass::SubClass1::Subclass2::DoFunctionCall();

As a side note, this syntax is being replaced by XML - HTML help will reference a 'Collection' as specified in a collection file (.col), which has XML entries in it. Much easier to read and follow than the obtuse PERL-like syntax in the alias file.

这篇关于在主chm文件窗口中的合并的chm文件中打开主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆