Microsoft HTML帮助 - 从主题ID获取主题页面URL [英] Microsoft HTML Help - Get the topic page URL from the topic ID

查看:247
本文介绍了Microsoft HTML帮助 - 从主题ID获取主题页面URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前正在使用HTML帮助在我们的软件中显示CHM帮助文件。



通过直接请求主题页面来实现这一点,我们希望改变我们打开帮助的方式。但是,我们希望保持主题ID的使用,以便编辑团队可以自由地重新构造和重命名帮助,因为他们认为合适,只有通过操纵地图和别名。



我一直在挖掘一些,找不到任何(合理便宜)的方式来获取一个从主题ID打开的URL,这样我可以请求在自定义窗口中打开的URL。

解决方案

AFAIK您需要一个有效的网址,主题文件名Garden / garden.htm使用Web浏览器控件时。所以其他解决方案是非常困难的,我认为不可能与一个网络浏览器控件。



你知道你可以做一个硬编码调用与。以下代码:

  public static string GetChmUrl(string fileName,string page)
{
StringBuilder url = new StringBuilder();
url.AppendFormat(mk:@MSITStore:{0} ::,fileName);
if(page.IndexOf('/')!= 0)url.Append('/');
url.Append(page);
return url.ToString();
}

  webBrowser1.Navigate(new Uri(GetChmUrl(Application.StartupPath + sHTMLHelpFileName_ShowWithoutAutoSync,Garden / garden.htm))); 

为了通过TopicId显示HTMLHelp主题而没有完整的帮助窗口,您可以创建一个特殊的窗口类型HTMLHelp查看器窗口。确定 - 这更多是帮助创作工作准备从您的应用程序的电话。可以通过以特殊方式编译CHM,并将其减少到通常位于HTMLHelp查看器右侧的内容窗格。



您可以通过TopicId调用内容,结果显示在快照中:

  private void btnTopicId_Click(object sender,EventArgs e)
{
Help.ShowHelp(this.btnOpenHelpShowTopic,helpProvider1.HelpNamespace,HelpNavigator.TopicId,@10000);
}



许多年前,有一个所谓的嵌入式帮助的应用程序,你可以在快照中看到。这是通过HTMLHelp API调用完成的。我有老的Delphi代码,但没有翻译成.net。 HTMLHelp使用将近20年,现在有更多的使用web帮助。所以你必须考虑和决定。





您需要使用编组从Visual C#应用程序调用非托管HTML帮助API。在.net中使用HTMLHelp API并不容易。为了尝试一下,你可以从下面的下载示例开始(文章末尾):



HTH。


We're currently using HTML Help to display CHM help files in our software. We'd like to change how we're opening the help however, to open it in our own custom window with an embedded browser.

Achieving this by directly requesting topic pages to be opened with URLs is straightforward enough, however, we'd like to maintain the usage of Topic IDs such that the editorial team can freely re-structure and re-name the help as they see fit, only by manipulating the maps and aliases.

I've been digging around for a bit and couldn't find any (reasonably cheap) way to get a URL to open from a Topic ID, such that I could request a URL to open in the custom window. Am I missing a trick, or are there any libraries out there that might facilitate this?

解决方案

AFAIK you need a valid URL with the topic filename e.g. "Garden/garden.htm" when using a web browser control. So other solutions are very difficult and I think not possible with a web browser control.

You know you can do a hard coded call with e.g. following code:

    public static string GetChmUrl(string fileName, string page)
{
  StringBuilder url = new StringBuilder();
  url.AppendFormat("mk:@MSITStore:{0}::", fileName);
  if (page.IndexOf('/') != 0) url.Append('/');
  url.Append(page);
  return url.ToString();
}

and

   webBrowser1.Navigate(new Uri(GetChmUrl(Application.StartupPath + sHTMLHelpFileName_ShowWithoutAutoSync, "Garden/garden.htm")));

For showing HTMLHelp topics by TopicId without the full blown help window you may create a special window type for the HTMLHelp Viewer window. OK – this is more a help authoring work preparing a call from your application. It’s possible by compiling the CHM in a special way and reduce it to the content pane normally on the right side of the HTMLHelp Viewer.

You can call the content by TopicId and the result is shown in the snapshot:

    private void btnTopicId_Click(object sender, EventArgs e)
{
    Help.ShowHelp(this.btnOpenHelpShowTopic, helpProvider1.HelpNamespace, HelpNavigator.TopicId, @"10000");
}

Many years ago there was a so called "embedded help" for application as you can see in the snapshot. This was done by HTMLHelp API call. I have old Delphi code but not translated to .net. HTMLHelp is used for nearly 20 years now and today there is more use of web help. So you have to think about and decide.

You need to use marshalling to call the unmanaged HTML Help API from a Visual C# application. Using HTMLHelp API in .net is not easy. To give this a try you may start with a download sample (at the end of the article) from: https://support.microsoft.com/en-us/kb/317406

I attached a snapshot too:

HTH.

这篇关于Microsoft HTML帮助 - 从主题ID获取主题页面URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆