3

I use HelpNDoc for providing a chm-file for the context sensitive help in my application.

In this software you define a help-ID and a corresponding help-context. The help-ID for example maybe "SystemSetup" and the help-context is 57.

Now my question:

I can call the help this way:

System.Windows.Forms.Help.ShowHelp(null, @"myhelp.chm", HelpNavigator.TopicId, "57");

and all works well, but can I some how call ShowHelp with the help-ID ("SystemSetup") instead?

I ask this cause the help-context can change, but the help-ID stays always the same.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
GreenEyedAndy
  • 1,485
  • 1
  • 14
  • 31

2 Answers2

0

There is no easy way to do that. The Topic ID is the best thing you have to directly point to a topic. The software we use to generate the CHM files allows names to be given to topics, which can be retrieved using your code.

If that doesn't work for you, and the only thing you have is the name, you might get it done by using the Topic enum value and the name of the HTML file (if it is distinct enough).

Something like this could be what you need (you can retrieve the html file name through an CHM viewer):

System.Windows.Forms.Help.ShowHelp(null, @"myhelp.chm", HelpNavigator.Topic, "SystemSetup.html");

I don't know which option is better. That is up to you and your specific scenario.

Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
  • Ok, the software is able to generate a sourcefile with constants, which I can use, but then I must be sure to use the corresponding sourcefile. Your example is working, but I think the best way (but not comfortable) is using the help-context (topic-ID). – GreenEyedAndy Dec 07 '15 at 10:21
  • You could use that. That is what we actually do too. Indeed. Maybe if the actual documentation file is XML based, you could generate some C# where you convert name to id... – Patrick Hofman Dec 07 '15 at 10:23
0

HelpNDoc uses the following pattern to name topic files: "HELP_ID.htm" where HELP_ID is the chosen unique Help Id for that topic. So you can reliably open a specific topic using the following command:

System.Windows.Forms.Help.ShowHelp(null, @"help.chm", HelpNavigator.Topic, "HELP_ID.htm");

Also, as you found out, HelpNDoc is able to generate a source file with constants. And you can automate its generation and include it in your build process by creating a new "Code" build. See the step by step guide: How to create a new documentation output to be published

jonjbar
  • 3,896
  • 1
  • 25
  • 46