| Overview | A Demo Project | Step 4? | $Global_ |
| Other Tips & Tricks | Linking Between Modules | Context Ids |
| Secondary Windows | Other Secondary Windows |
| Known Bugs | Others Say |
Last update: 8-July-2015 (added Georgian translation)
Translations of this page:
This document will help you to get merged CHM files working.
Many thanks to Müller-Hillebrand in Germany for making it work when all the others couldn't. Also to Kate Pearson at Varian Australia for the word-smithing.
Modular help benefits
Modular help problems
The following demo project will be used to illustrate how CHM files can be merged. The demo project consists of the following:
1x Master chm file (Master.chm)
2x Slave chm files (SiteA.chm & SiteB.chm).
When you open the demo project, you should see the following:
1. Download the demo project (merge.zip - code for this demo).
2. Download further demos (merge_chapter.zip - Another example: code & documentation).
Lets assume we have 3 modules, each with its own Table of Contents (.HHC) file. The first step is to merge all of the 'slave' .HHC files into the 'master' .HHC file (We are calling the Master module, the module the others merge into).
Instructions:
Step 1a:
Open the Master.HHC (master contents file) by double clicking it in Explorer. This will open HH Workshop and enable you to edit Master.HHC.
Step 1b:
Right click on a TOC item and select "Insert File". Enter the SiteA contents file as "SiteA.CHM::\SiteA.HHC".
Step 1c:
Repeat Step 1b, this time adding the SiteB contents file "SiteB.CHM::\SiteB.HHC".
That's the master TOC done. The slave HHC files require no special changes.
Open Master.HHP project file and add a [MERGE FILES] section containing the names of all other CHM files (do not add the projects own CHM file).
Instructions:
Step 2a:
Open Master.HHP in workshop. Open the "Project Options" dialog and select the "Merge Files" page tab. Using the "Add" button, add SiteA and SiteB CHM files to the list. Do not add Master CHM.
If you want SiteA.CHM and SiteB.CHM to open the same as Master.CHM proceed to Step 2b.
Step 2b:
Repeat Step 2a for all modules. Again make sure that you don't include a projects own CHM in its own merge list.
The 3 HHP project files should now all contain a reference to each of the other project's CHM files.
<SiteA.HHP>
[MERGE FILES]
Master.CHM
SiteB.CHM
<SiteB.HHP>
[MERGE FILES]
Master.CHM
SiteA.CHM
<Master.HHP>
[MERGE FILES]
SiteA.CHM
SiteB.CHM
If you want SiteA.CHM and SiteB.CHM to open with the same TOC as Master.CHM then these additional steps are required.
Master.HHP is straightforward and has the following window definition:
[WINDOWS]
TP=,"Master.HHC" ,"Master.HHK", "Master.htm"....
To make a slave use the master HHC Table of Contents we use the following syntax:
"masterCHM::\masterHHC".
Master CHM window definition.
SiteA
<SiteA.HHP>
We have given SiteA, two window definitions. Use "TP=" to use the master CHM TOC. Use "TP2=" definition to use the SiteA.HHC TOC.
You can create as many window definitions as required.
[WINDOWS]
TP=,"Master.CHM::\Master.HHC", "SiteA.HHK","index_a.htm"....
TP2=,"SiteA.HHC","SiteA.HHK", "index_a.htm","index_a.htm"....
SiteB
<SiteB.HHP>
The SiteB "TP" window definition displays the SiteB TOC. To view the master TOC for SiteB use the "TP2" window definition.
Note: The .HHP file "Default Window=TP" sets the window definition to use when the CHM is opened.
[WINDOWS]
TP=,"SiteB.HHC", "SiteB.HHK", "Index_B.htm"....
TP2=,"Master.CHM::\Master.HHC", "SiteB.HHK", "index_b.htm"....
Remember the 3 steps.
Q.
A.
In a merged help system, can the application open a topic in a slave module via the master chm?
No. You must specify the module that contains the topic.
EG. "slaveA.chm::/slaveA_topic.htm" .
The following wont work. "master.chm::/slaveA_topic.htm".
Q.
A.
How can I force all modules to open in a single window?
Prefix all window definition names with "$global_".
In the examples above we would use "$global_TP" not "TP".
This is what Ralph Walden from KeyWorks says about "$global_".
http://keyworks.helpmvp.com/home/keyhh
<<<
Because of the way HTML Help 1.2 handles unnamed window types, you may still get multiple windows when HTML Help 1.2 is installed, particularly when working with multiple help systems (e.g., merged CHM files). To resolve this problem, declare a window type whose name begins with the prefix "$global_" in each CHM file. For example:
file1.chm::/file1topic1.htm>$global_task
file2.chm::/file2topic1.htm>$global_task
The $global_" prefix tells HTM LHelp that the window type can be used by any CHM file once the initial window type has been opened.
>>>
General Tips
| Simple Links | ALinks | ALinks Tutor | Related Topics | Related Topics Tutor |
Simple Links
Use the anchor link for simple inter-module links.
Example: <a href="ms-its:SiteA.chm::/Index.htm">Link Text</a>
Tip: IE3 developers should use the "mk:@MSITStore:" prefix
This method is OK if the CHM is definitely installed, however some modules of a merged help system may not be installed.
ALinks
Assign an identifier to any topic in your help system and link to the topic using that identifier. If more than one topic shares the same identifier then the link will display a jump list. The real power of ALinks is that they do not require you to specify the name of the target CHM file. Nifty!
Advantages
Disadvantages
Summing up: Use ALinks to handle your See Also jump lists. For single links, where the target CHM is known, use Related Topics (see below) which require simpler coding.
ALinks Tutor
1.
2.
To setup the target topic
The following code is inserted into your document
<Object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="ALink Name" value="my_topic_id">
</OBJECT>
To create the link to the topic
The following code is inserted into your document
<OBJECT id=my_alink type="application/x-oleobject"
classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
codebase="hhctrl.ocx#Version=4,73,8252,0">
<PARAM name="Command" value="ALink">
<PARAM name="Item1" value="">
<PARAM name="Item2" value="my_topic_id">
</OBJECT>
Lastly if you chose to define a button link then the job is done. Compile, open and test your CHM.
If you want to activate the code from a link then use
<a href="javascript:my_alink.Click();">Some Hyper Text Here<a>
Special Note:
To divert the user to another page if the link fails then add the following optional line to the above code.
<PARAM name="Default Topic" value="filenotfound.htm">
This tip was provided by "Marta Arriazu" <M.Arriazu(AT)Lantek.es>
Thank goodness someone reads the documentation.
Related Topics
Don't let the name fool you. These links are simple to code and are perfect for creating inter-module links.
Advantages
Disadvantages
The next section will show you how to code related topics.
Related Topics Tutor
Here's how to setup a Related Topics link using Workshop. Once you know what you are doing you can simply paste the code into any HTML editor.
1.
2.
To Add a Link
From the add / edit links page. Click add to open the "Add/Edit Related Topics" dialog.
The following code is inserted into your document
<OBJECT id=mylink type="application/x-oleobject"
classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
codebase="hhctrl.ocx#Version=4,73,8252,0" width=100 height=100>
<PARAM name="Command" value="Related Topics">
<PARAM name="Button" value="Text:Relative Topic Jump">
<PARAM name="Item1" value="This text never seen;SiteA.chm::/Index.htm;CHMFileNotFound.htm">
</OBJECT>
8-dec-2005:
Removed the ms-its: or mk:@MSITStore: prefix. This causes a popup error in newer versions of HTML Help. Here's the old code:
<PARAM name="Item1" value="This text never seen;ms-its:master.chm::/topic.htm">
Lastly if you chose to define a button link then the job is done. Compile, open and test the CHM.
If the target CHM file is not installed the help system will display the Alternate file "CHMFileNotFound.htm" where you can tell the user how to install the extra help module.
If you want to activate the code from a normal hyper link use
<a href="javascript:mylink.Click();">Some Hyper Text Here<a>
We all know how to set up our projects for Context calls from the main application (see how_to_context.htm). People tend to come unstuck with merged help systems. ie. How does an application make a context call to a slave topic though the master CHM.
The following examples show context mapping info from a Master .HHP file.
Bad Solution #1:
This will fail. The system assumes that the topic is in the current CHM (Master).
[ALIAS]
IDH_MyTopic=slave1_topic.htm
[MAP]
#define IDH_MyTopic 1000
Solution #1:
The ULR contains the full path to the slave topic. Since the latest critical update (hhctrl.ocx 5.2.3735.x) we have found that the indexes do not merge using this technique. Only the master index shows in the index navigation page tab.
So this is a good solution if you do not use an index tab. Also Marc Islam (MSFT) points out that you must use $Global_ if you want TOC auto-sync to work correctly.
[ALIAS]
IDH_MyTopic=ms-its:SlaveA.chm::/slave1_topic.htm
[MAP]
#define IDH_MyTopic1000
Solution #2:
This strange URL format fixed our TOC auto-sync problem for a while. However since the latest critical update (hhctrl.ocx 5.2.3735.x) TOC auto-sync is completely broken even when using $Global_. Recent tests by various authors also reveal that some days the Index merges correctly and some days it does not -- We can't explain this discrepancy in results. So stick with Solution #1 if you have no index.
[ALIAS]
IDH_MyTopic=ms-its:master.chm::/SlaveA.chm::/slave1_topic.htm
[MAP]
#define IDH_MyTopic1000
Solution #3:
You could configure each slave CHM to use the Master TOC and merge with all other CHMs (We showed this in Step 3 of the Demo Project above). Thus each Slave when opened directly will have the same content as the Master. Define all your Slave1 mappings in Slave1 .HHP and open Slave1 CHM when making a context call to a Slave1 topic. Problem with this approach is your application would need to deal with several CHMs instead of making Context calls though a single CHM (master). Also information such as favourites and window size and position are not merged. This info is saved under the CHM file name.
Solution #4:
1-Jan-2003: Finally some solutions that work.
Secondary windows are a snap when using Related Links and TOC Links. Simply fill in the name of the Window Definition you want to use using Workshop.
Note: Secondary window support broke in HH 1.2 for ALinks and KLinks. The word is that they are fixed again in HH 1.21.
Before reading further you should read the section above on Related Topics.
Forget about multiple CHMs for a second and lets quickly look at other ways to produce secondary windows.
See also my rough notes on using ShowHelp()
(Nice overview from George Farkas)
Great Tips from -- Sean Stagner
(How to setup context help with merge. Includes a RoboHelp 2000 perspective)
Tip from Kelly Holmes
Kelly Holmes notes that when you click on a link to another CHM module, the link color does not change to the visited color. There is no fix that we know of.
From: Leigh, Daniel
Subject: Merged help file tip
Date: Wed, 19 May 1999 18:03:50 -0500
Robert,
A further refinement to your merged help file tips. Maybe you know this already, but I recently discovered that the [MERGE FILES] section accepts #include statements. So you can say:
[MERGE FILES]
#include MyFileList.txt
Now you only have to maintain one list of merged files and just #include it in each project.
(Your instructions on the web page explicitly state not to include a project's own CHM in its own merge list. I'm not sure why: I haven't discovered any problems with it so far).
From: Mills Perry
Subject: Merged helps on Read-Only Media
Date: 07 Oct 1999
When you open a merged compiled help file (.chm) for the first time, it creates in the same directory as the .chm file an index file with a .chw suffix. The .chw file contains merged kwords. The CHW file will not be created if HTML Help cannot write to that directory. Without the .chw file, your index tab will not display a merged index if you have multiple .chms, and your included TOCs will not include. Other things may not work properly either, but these are the most visible issues.
HOW TO PROPERLY PUBLISH READ-ONLY
1. You need to create the .chw file by opening the master .chm file. You can do this in multiple ways:
a. Open the master .chm in your development environment and move the generated .chw along with the new/changed .chms as part of your company's change management process.
b. Have somebody with write access to the network directory where the production .chms reside manually open the master .chm file to generate the .chw.
c. Write a program to automatically regenerate the .chw after any.chms get changed. This program just needs to call the HTML Help API to display the master .chm's index, and pause long enough for the index to generate before terminating.
2. The .chw must be regenerated any time any merged .chm is updated, no matter how trivial the update. If this is not done, your TOC includes will fail, and your indexes will not merge.
<From Rob Chandler>
A couple of things to add to this CHW discussion
1. If you do not have an Index tab or Keywords then chw files are not produced.
2. You must click on the index tab to create the CHW file.
3. If your slave CHMs contain klink/index merge then these must be run once as well to create their CHW files.
4. MS HTML Help creates the chw file uncompressed (for speed). However they can be compressed. A 50MB MSDN CHW file is reduced to 5MB. Compression simply removes the dead space from the IStorage file. The shareware utility FAR can compress Chw files.
From: Yuko Ishida
Subject: HH 1.3+CSS+multi-print
Date: Sun, 20 Feb 2000 14:22:18 +0900
Robert Chandler: Great tip from Yoko for getting multi page printing to work under HH1.3.
Toying with Windows 2000 Help, I noticed that the topic is linked to css files with MS-ITS syntax.
<LINK REL="stylesheet" MEDIA="screen" TYPE="text/css"
HREF="MS-ITS:ntshared.chm::/coUA.css">
Eureka! I created the following help and linked html files to test.css.
test.hhp
test.chm
-html folder
-topic1.html
-topic2.html
-css folder
-test.css
<LINK REL="stylesheet" TYPE="text/css"
HREF="MS-ITS:test.chm::/css/test.css">
And css works in multi-page print mode. Apparently this only works with HH 1.3. When I try the same method with HH 1.21, multi-print fails.
One of very few virtues of 1.3?
From: Matthew Ellison
Subject: Any way to disable the context menu for the HTML Help TOC?
--My testing showed that the maximum number of files that you can merge
(i.e. the maximum number of files that you can list within the [Merge Files] section of the .hhp file) is 1148. Any higher than that, and the compilation breaks down. This seems rather an arbitrary number -- do you know if it depends on the resources of the computer on which you are compiling?
Rob: My guess is if you went to an XP Pro PC with more memory you would get further ;-) Ralph?
--Consider the following merged HTML Help system
main.chm
sub.chm
*sub.chm (where * is any set of characters)
sub.hhc and *sub.hhc are included within main.hhc. Only sub.chm is listed within the [Merge Files] section of main.hhp. If you compile, select any topic from *sub.chm from the merged TOC, and then attempt to select any topic from sub.chm the topic is not found.
The moral is either ensure that you list all sub-CHMs within [Merge Files] or avoid naming pairs of sub-CHMS in this way
name1.chm
*name1.chm
Rob: Thanks Mathew. Interesting: yes renaming files, rebooting all help when weird things happen. :-)
Rob: PS. More info... Paul O'Rear [MS] queried some of the guys who used to work with HTML Help collections (Visual Studio 6). The most the help team ever merged was around 800-900. They never saw a problem with this number. Also Chris from Emerson reports that search of slave text failed after adding 1105 items to the [MERGE FILES] section of the .HHP project file. He was testing with only a few CHMs. So the problem is the Compiler (Workshop) rather than the runtime system.