5

I want to open a CHM file from my C# project. I want to open the relevant section of the CHM file, thus I use the following code line

Help.ShowHelp(this, help_file, HelpNavigator.TopicId, topic_id);

The problem is, I don't have the source of the CHM file and I don't know the topic IDs of it. Is there a way to get the topic IDs of this CHM file?

mustafa
  • 3,605
  • 7
  • 34
  • 56
  • possible duplicate of http://stackoverflow.com/questions/3440868/help-file-topic-id – Developer Mar 06 '12 at 10:28
  • @User yes, the same question. But it was not answered too. I don't have the source code of the CHM project. Is there a way to explore the topic ids of a chm file? – mustafa Mar 06 '12 at 11:36
  • possible duplicate of [Get a list of topics from a chm file in C#](http://stackoverflow.com/questions/2276019/get-a-list-of-topics-from-a-chm-file-in-c-sharp) – Hans Passant Mar 06 '12 at 12:08

1 Answers1

2

Extract the CHM with one of the various extracters (mostly chmlib based), and then look into the extracted "*.hhc" file. This is an topic map that matches topic tiles/ids to urls internal in the CHM file.

Note some rare CHM files have a binary TOC and no hhc file, but chances on that are very low, since HH defaults discourage it.

Added later: The number of extraction options of the Free Pascal chmls tool have been updated. (though some are more of a dump functionality than real extraction): Make sure you get one from 2.6.4+

 list        [section number]
            Shows contents of the archive's directory
 extract      [saveasname]
            Extracts file "filename to get" from archive "filename",
            and, if specified, saves it to [saveasname]
 extractall  [directory]
            Extracts all files from archive "filename" to directory
            "directory"
 unblockchm  [filespec2] ..
            Mass unblocks (XPsp2+) the relevant CHMs. Multiple files
            and wildcards allowed
 extractalias  [basefilename] [symbolprefix]
            Extracts context info from file "chmfilename"
            to a "basefilename".h and "basefilename".ali,
            using symbols "symbolprefix"contextnr
 extracttoc  [filename]
            Extracts the toc (mainly to check binary TOC)
 extractindex  [filename]
            Extracts the index (mainly to check binary index)
 printidxhdr 
            prints #IDXHDR in readable format
 printsystem 
            prints #SYSTEM in readable format
 printwindows 
            prints #WINDOWS in readable format
 printtopics 
            prints #TOPICS in readable format

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89