Calling topics from VB.Net no longer works

This section is for programmers. Please use it for all discussons on interfacing help with your applications and related subjects.

Moderators: Alexander Halser, Michael Schwarzl

Post Reply
rdlsz24
Posts: 2
Joined: Tue Nov 23, 2010 5:49 pm

Calling topics from VB.Net no longer works

Unread post by rdlsz24 »

We upgraded to version 5 of H&M a while back (I don't know what version we had before), and it seems the code we were using to open our help manual to a specified topic no longer works. We are using VB.Net in Visual Studio 2010. Here is a sample of code that used to work:

Help.ShowHelp(Me, m_helpFile, "reporting2.htm")

where me is the parent, m_helpFile is the location of our .chm file, and reporting2.htm was the name of the topic.

I do see that with version 5 there aren't the individual .htm files to link to anymore. I see there are xml files now, but linking to them using the above code doesn't work anymore either. It seems like the only thing I can get to work anymore is just opening the manual to the first page using Help.ShowHelp(Me, m_helpFile, HelpNavigator.TableOfContents)

Can you give me some sample code that I would use to open up the help manual to a specific topic? Say I have a topic named User Search.... how would I open my manual to that topic?

Rob
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Calling topics from VB.Net no longer works

Unread post by Tim Green »

Hi Rob,

There hasn't been any change to the internal structure of the CHM files generated so you basically need to check your call. The .htm topic files are still all on the root level inside the CHM, so you just need to call the CHM file and the topic file inside it. Things to check include the name of the CHM file (avoid spaces and special characters!), the path to the CHM (the ancient Microsoft CHM viewer is also allergic to spaces and special characters in paths and also to long paths) and the actual names of the topic files inside the CHM. If your topic IDs contain any special characters (including the - dash character) they will be converted to underscores on compiling, so you need to bear that in mind.

I'm asking our developers to have a look at the thread too, they may have additional comments. :)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
Alexander Halser
EC-Software Support
Posts: 4098
Joined: Mon Jun 24, 2002 7:24 pm
Location: Salzburg, Austria
Contact:

Re: Calling topics from VB.Net no longer works

Unread post by Alexander Halser »

As Tim pointed out, there are not structural changes in the CHM compilation betwen HM4 and HM5.

You should first check that you are indeed addressing a valid topic name. To do this, compile a CHM file with the option "Delete temporary files" switched off (this is a checkbox in the export dialog box). Then look in the ~tmpchm folder that's been created in your project folder. Is the HTML file that you are calling there? If yes, the problem is in the VB.Net call. If not, check if the topic ID has changed or if the topic is perhaps excluded from the compilation.

Basically, the XML files from the H&M source turn into HTML files when exported to CHM. All HTML files are compiled into the root folder of the CHM, elimitating troubles with internal pathes. The call should still work.

You didn't say what result you get with the ShowHelp call. Is the CHM file displayed at all? What topic is display? Do you get an error? Keep in mind that CHMs are designed for local use. If it's on a network drive, MSIE might refuse to display this topic. If you get an "Action canceled" message, try HHReg to fix it: http://www.ec-software.com/products_hhreg.html
Alexander Halser
Senior Software Architect, EC Software GmbH
User avatar
Winsteps
Posts: 443
Joined: Wed Aug 29, 2007 7:34 am

Re: Calling topics from VB.Net no longer works

Unread post by Winsteps »

rdlsz24, VS2010 VB.NET and CHM files generated with HM5 work fine for us, with this call:

Help.ShowHelp (TopLevelForm, CHMpath, "mytopic.htm")

TopLevelForm: we reference the top-level form to avoid the Help screen closing unexpectedly (from the perspective of the end-user).
CHMpath is the full pathname of the .chm file
mytopic.htm is the same name as the WebHelp name.

Microsoft seems to prefer something like:
Help.ShowHelp (Me, CHMpath, HelpNavigator.Topic, "/mytopic.htm")

Suggestion: try displaying a topic using its TopicID to verify that the Topic is correctly embedded in the .chm file:
ShowHelp (Me, CHMpath, HelpNavigator.TopicId, MyTopicId.ToString)
rdlsz24
Posts: 2
Joined: Tue Nov 23, 2010 5:49 pm

Re: Calling topics from VB.Net no longer works

Unread post by rdlsz24 »

Ok it is working now using the same old code. I was trying to use the Topic / Topic ID stuff and that didn't seem to work. Once I used Help.ShowHelp(Me, ConfigurationManager.AppSettings("HelpFilePath").ToString(), "user_search.html"), it worked just fine. Leaving the temp files in ~tmpchm helped me to see the correct html names. Thank you for your help

Rob
Post Reply