How to open specific topic from a chm file?

2019-09-18 23:50发布

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

标签: c# chm
1条回答
倾城 Initia
2楼-- · 2019-09-19 00:29

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.

查看更多
登录 后发表回答