c# – 如何在CHM文件中查找主题ID

我想从我的C#项目中打开一个CHM文件.我想打开CHM文件的相关部分,因此我使用以下代码行

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

问题是,我没有CHM文件的来源,我不知道它的主题ID.有没有办法获取此CHM文件的主题ID?

最佳答案 使用各种提示符之一(主要是基于chmlib)提取CHM,然后查看提取的“* .hhc”文件.这是一个主题图,它将主题图块/ ID与CHM文件中的内部网址相匹配.

请注意,一些罕见的CHM文件具有二进制TOC且没有hhc文件,但由于HH默认值不鼓励它,因此它的可能性非常低.

后来添加:
Free Pascal chmls工具的提取选项数已更新. (虽然有些更像是转储功能而不是真正的提取):确保从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

点赞