Help.ShowHelp and CHM Files with Embedded CHM Files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Our application currently uses the HtmlHelp library to show help pages. We
have a top level CHM file made up of sub CHM files. Clients can invoke our
ShowHelp method and pass the name of their CHM file and the page internally
to show. We can show this page just fine with HTMLHelp.

We are trying to switch to System.Windows.Forms.Help and its ShowHelp
method, however the format of the 'url' to the CHM seems to be different.

HtmlHelp supports the following URL format:
"Main.Chm::/SubChmFile.Chm::/SubChmFilePage.htm"

The .NET equivalent throws an exception when this is done. All I Have been
able to do is show the help book without specifying a specific page. Is
there a way to get the .NET version to show a page within the main CHM book
or a sub CHJM book?

Thank You,
 
Hi Brian,

Based on my understanding, you want to specify a specific html file within
the chm help file to display in .Net Winform.

This task can be achieved by adding a HelpProvider to Winform. You should
set HelpProvider.HelpNamespace to your chm file. And then, you should
invoke SetHelpKeyword to set the url within the chm file
and SetHelpNavigator to set HelpNavigator.Topic, please refer to the link
below for sample code and details:
http://groups.google.com/group/microsoft.public.dotnet.languages.vb/msg/7028
081adffb0f92?hl=en&

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Jeffrey,

Thank you for your response. I tried your suggestion and made it work for a
form, button or control. However in our plugin environment that uses COM
plugins, all components call one main (generally windowless) client to
display the help. The old implementation was just a VB class that invoked
HtmlHelp.

In the .NET version, we are still providing a 'class' component that is not
a form to provide this functionality. I was hoping that the HelpProvider
could be created, configured and then invoked to display a help page.

Actually I was hoping to invoke the Help.showHelp and pass it a HelpProvider
as a parameter and ask it to display, but that option does not exist.

Can you help me figure out how I could easily and straightforwardly display
the help window at the proper page without a form (other than to parent/own
it) ?

The method is in a class object and is called 'ShowOurHelp' and clients pass
in the CHM file and html page within the CHM to display. This class would
like to show the help without having to call into a form.

--
Brian R.



"Jeffrey Tan[MSFT]" said:
Hi Brian,

Based on my understanding, you want to specify a specific html file within
the chm help file to display in .Net Winform.

This task can be achieved by adding a HelpProvider to Winform. You should
set HelpProvider.HelpNamespace to your chm file. And then, you should
invoke SetHelpKeyword to set the url within the chm file
and SetHelpNavigator to set HelpNavigator.Topic, please refer to the link
below for sample code and details:
http://groups.google.com/group/microsoft.public.dotnet.languages.vb/msg/7028
081adffb0f92?hl=en&

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Brian,

To show a specified html page in a CHM file, we could call the
Help.ShowHelp(Control, String, String) overload, which displays the
contents of the Help file found at the specified URL for a specific keyword.

For example, we have a CHM file called test.chm and it contains an html
page called anote.htm. We can show this anote.htm using the following code:

private void button1_Click(object sender, EventArgs e)
{
string helpfile = Application.StartupPath + "\\test.chm";
Help.ShowHelp(this, helpfile, anote.htm);
}

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
I started wiht that method, however it does not appear to allow you to browse
to a particular page within a CHM. It works fine just to launch and show the
window, but I can't programmatically navigate to a page.

We build a CHM book from other CHM files that consist of Html pages. We
were previously using the HtmlHelp call to opena book at the following
location

C:\MyApp\Main.Chm::/SubBook.chm::/MainPage.htm

However when I pass this to ShowHelp, it throws an exception as an invalid
file. I was hoping my formatting was wrong, but I couldn't find any
information on the web.

So Help.ShowHelp doesn't quite do enough as I can see.
 
Hi Brian,

Thank you for your prompt response.

Open your CHM book and navigate to the MainPage.htm. Right-click on an html
page in the html viewer and choose Properties. In the Properties window,
you may see address of the html page, e.g.
mk:@MSITStore:D:\myhelpfile\test.chm::/ch03a.htm.

Please tell me what you see for the html page address.

You have mentioned you use the following location

C:\MyApp\Main.Chm::/SubBook.chm::/MainPage.htm

navigate to the html page. You may have a try passing
"SubBook.chm::/MainPage.htm" to the Help.ShowHelp method. The following is
a sample:

Help.ShowHelp(this, thepathtoCHMfile, "SubBook.chm::/MainPage.htm");

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support
 
Very useful Linda. I figured that there was a way to use this method to
invoke the help since HtmlHelp provides the capability currently.

I called the method passing the main book as the second parameter and hten
the sub book and ::/ Page as the keyword. Reading the MSDN help would not
lead me to believe that I could pass this content for the keyword and have it
navigate. The examples are quite limited.

From MSDN: The keyword to display Help for.

Not sure that I would have ever figured out that I could pass a sub book and
an Html Page as the 'keyword'.

Thanks for your help!

"Keyword":
 
Brian

Yours was the only post I found that worked, after a day of searching.
Let me give an example that may help others.

Help.ShowHelp(Me, HelpProvider1.HelpNamespace, "Operation2.htm")

Where:
1. HelpProvider1.HelpNamespace is the path to the *chm file.
So you could instead enter the file path directly as a string.
2. The third parameter, "Operation2.htm" specifies the topic ID.
Actually the topic ID in the source code for the help compiler I use
(Help and
Manual) is just "Operation2" but you need to add the ".htm"

Steve
 
Back
Top