How to open specific topic from a chm file?

巧了我就是萌 提交于 2019-12-12 04:45:15

问题


I have create chm file from chm processor software. By clicking on properties of particular topic I got htm link

htm link : mk:@MSITStore:D:\my.chm::/start.htm#_Toc417986991

But when I am trying to open from my c# app its giving error

c# code:

System.Windows.Forms.Help.ShowHelp(null, @"D:\my.chm", @"mk:@MSITStore:D:\my.chm::/start.htm#_Toc417986991");

When I am running my code and trying to open its giving error

"This program cannot display the webpage"

Please help me to find solution of this issue


回答1:


Please add a HelpProvider to your form and try something like the following code:

private const string sHTMLHelpFileName_ShowWithNavigationPane = "CHM-example_ShowWithNavigationPane.chm";    
private void btnHelpTopic2_Click(object sender, EventArgs e)
{
helpProvider1.HelpNamespace = Application.StartupPath + @"\" + sHTMLHelpFileName_ShowWithNavigationPane;
Help.ShowHelp(this, helpProvider1.HelpNamespace, @"start.htm");
}

The help CHM help file was added to the project in a subfolder e.g. \hlp. For download I provide a C# VS2008 Project including the code above and the help files with different help viewer windows (different CHM files for show case only).

Please think of #_Toc417986991 as a internal bookmark generated by CHM Processor Software.



来源:https://stackoverflow.com/questions/32456300/how-to-open-specific-topic-from-a-chm-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!