17

I have created a .CHM file and then when I open it in c# I get the First topic. I want to open it to a specified topic. This is the code I use right now to open it.

Help.ShowHelp(this, "./Resources/ServerHelp.chm");

I want to be able to open it to a specific topic like Audio. I tried using

Help.ShowHelp(this, "./Resources/ServerHelp.chm", HelpNavigator.Topic, "Audio");

and it showed me page not found. Can i get some Help with my Help please !! :P

dreftymac
  • 31,404
  • 26
  • 119
  • 182
Prince Champappilly
  • 303
  • 1
  • 7
  • 29
  • possible duplicate of [open specific part of table of contents of chm file c# or vb.net](http://stackoverflow.com/questions/19129639/open-specific-part-of-table-of-contents-of-chm-file-c-sharp-or-vb-net) – Aaron Palmer Mar 10 '14 at 12:40
  • 1
    Please, do not include information about a language used in a question title unless it wouldn't make sense without it. Tags serve this purpose. – Ondrej Janacek Mar 10 '14 at 12:40
  • okay, I searched here on stack overflow and still couldn't get it to work cause all the steps where not clearly explained. So when I figured it out, I thought I would just put it out here, now I realize I could have just answered the other persons question. ill keep that in mind for future reference. – Prince Champappilly Mar 13 '14 at 09:58

2 Answers2

24

This can be achieved by the following steps:

  1. Identify what names the chm uses to refer the internal topics. This is done by

    • Open the CHM file, and right click in the topic page and select Properties.
    • The property called: Address (URL) Contains the topic page name at its end.

    Here is an example:

    mk:@MSITStore:C:\Program%20Files\Silsila%2011\Silsila.chm::/Audio.htm
    

    Here the topic page name is "Audio.htm"

  2. Call the Help.ShowHelp() function with the correct parameters as shown below

    Help.ShowHelp(this, "./Resources/Silsila.chm", HelpNavigator.Topic, "Audio.htm");
    

That should do it. you can fine the topic name of the pages you want using Step 1, and then use Step 2 to open the help file on that page.

bluish
  • 26,356
  • 27
  • 122
  • 180
Prince Champappilly
  • 303
  • 1
  • 7
  • 29
  • Thanks. What about when your "context" is now a form and you still want to trigger to display the CHM at the default topic? In that context "this" is not accepted because "this" is not a winform etc.. – Andrew Truckle Sep 28 '21 at 19:24
3

The same also works to create a windows shortcut opening a specific page. Use that as "target" command line :

C:\Windows\hh.exe ms-its:[file_name.chm]::[page_name.htm]

If you do not know [page_name]: from the chm help viewer, try to print the target page on a virtual printer like PdfCreator. The output filename automaticaly generated will probably contain [page_mane].

With thanks to sazr for the intial syntax !

Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164