`
maomaozgc
  • 浏览: 338996 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

window.showHelp 系列3 连接chm

阅读更多
通过window.showHelp()来连接上chm文件是要求在本地有效。
或者将chm文件下载到本地系统中。
以下详细介绍:

Linking to a CHM - Some Notes
5-Nov-2004: ShowHelp() Breaks under XP SP2

Have a few reports now telling us ShowHelp() has changed yet again under the release of SP2.

David from Unisys informs me that these links used to work inside a HxS file (MS Help 2).
JavaScript:showHelp('its:TestHelp.chm::/HTMFilename.htm')
JavaScript:showHelp('ms-its:TestHelp.chm::/HTMFilename.htm')

However this link still works
JavaScript:showHelp('mk:@MSITStore:TestHelp.chm::/HTMFilename.htm')

The problem has been reported to MS
 
Robert Powell reports that web links now fail
window.showHelp("http://myServer/help/myHelp.chm")

This was intentionally done by MS for security reasons. CHMs can only be opened on the local PC.
Some of the examples below you will find no longer work.



--------------------------------------------------------------------------------

Some ruff notes on linking to a CHM (local/web).
Test machine: Win98 + IE4SP2/IE5 + HH 1.2

From a source at MS says:

HTML Help 1.x does not have the capability of delivering compressed help over
http. You can point to a .chm on the user's local drive, and you can link to
a .chm for download, but that's as far as it goes. This feature has been
tentatively planned for future versions, as there have been many requests for it.


--------------------------------------------------------------------------------
1. Link to a CHM file - Page pulled into Browser:This appears to only works with a fully qualified path to the CHM.

(1.a) - Full path to CHM - ** OK **
    ms-its:http://www.helpware.net/htmlhelp/help.chm::/masterfile.htm
    mk:@MSITStore:http:/www.helpware.net/htmlhelp/help.chm::/masterfile.htm
    BUT... This fails from inside a CHM file.
    5-Nov-2004: This now shows a blank page since XP SP2 I thing - * Now Fails *
   

(1.b) - Full path to local CHM - ** OK **
    ms-its:c:/windows/help/fonts.chm::/windows_fonts_overview.htm
    mk:@MSITStore:c:/windows/help/fonts.chm::/windows_fonts_overview.htm

    5-Nov-2004: This will work if you download this page to the local PC

(1.c) - Relative path to web CHM - ** Fails **.
    ms-its:help.chm::/masterfile.htm

    5-Nov-2004: This works from inside a HxS VS Help file. Currently broken under XP SP2

Note: These links work -- However the entire CHM is being downloaded to your cache. First time will take forever. Second time will be quick as it loads from the cache.

(1.d) Link to a topic in a CHM on the web - ** OK **
<A HREF="ms-its:http://www.helpware.net/htmlhelp/hhaxref1.chm::/ocx_ov.htm">Link to a topic in a .chm</a>
Link to a topic in a .chm
5-Nov-2004: This will fail under SP2 * Now Fail *


2. Standard Link to a CHM file - download dialogWithout the ms-its: prefix your browser will try and download the CHM
with the standard Open or Save question.

(2.a) - Full path to CHM only - ** OK **
<a href=http://www.helpware.net/htmlhelp/help.chm>


(2.a) - Relative path to CHM only - ** OK **
<a href=help.chm>


(2.c) - Link to topic in file - ** Fails ** (not expecting this one to work)
<a href=http://www.helpware.net/htmlhelp/help.chm::/masterfile.htm>



3. Link to CHM file using window.ShowHelpYou can also link to a CHM (from HTML or CHM Topic) using ShowHelp().
ShowHelp is about the only way you can open a HH window (not just extract a topic)
from a single HTML page. It also works from a CHM based topic, but the CHM
must be local. Window.ShowHelp() does not work for web based CHMs.

5-Nov-2004: Most remote links now fail under SP2.


Web link does not work:

(3.1) - Link to web CHM using VB link via window.ShowHelp() - ** Fails **
    window.ShowHelp("ms-its:http://www.helpware.net/htmlhelp/help.chm::/masterfile.htm>TP2"
    Same link but Uses JavaScript


Local works:

(3.2) - Link to local CHM using VB link via window.ShowHelp() - ** OK **
   window.showHelp('ms-its:D:\UVHelp\SPLIT\help.chm::/masterfile.htm>TP2')
   window.showHelp('ms-its:D:\UVHelp\SPLIT\help.chm')
   BUT... This fails from inside a CHM file. Expected.

   Download the CHM locally if you like and put it in a folder called "D:\UVHelp\SPLIT\"

(3.3) - Same as 3.2 but uses relative path - ** Fails **
   window.showHelp('ms-its:file:///help.chm::/masterfile.htm>TP2')
   window.showHelp('ms-its:help.chm::/masterfile.htm>TP2')

Special Note:
I have to be very very careful here. If I run this file locally first (via 3.2), then the Links 3.1 and 3.2 start firing by bringing up the local file. This is confusing behaviour and is just wrong as far as I am concerned. See Ralphs comments below.

IE5 is a little different. Relative Paths DO work but always use UNIX slashes:

These work..

window.showHelp('C:/EUDORA/ATTACH/al.chm')
window.showHelp('file://C:/EUDORA/ATTACH/al.chm')
window.showHelp('mk:@MSITStore:C:/EUDORA/ATTACH/al.chm')
window.showHelp('Test/al.chm')
window.showHelp('file://Test/al.chm')

These do not work...Sort of. Chm opens but topic cannot be found<br>

window.showHelp('mk:@MSITStore:TEST/al.chm')
window.showHelp('its:TEST/al.chm')

These do not work..

window.showHelp('C:\EUDORA\ATTACH\al.chm')
window.showHelp('file://C:\EUDORA\ATTACH\al.chm')
window.showHelp('mk:@MSITStore:C:\EUDORA\ATTACH\al.chm')
window.showHelp('mk:@MSITStore:TEST/al.chm')
window.showHelp('Test\al.chm')
window.showHelp('file://Test\al.chm')

Conclusion: For IE5.

1. Must have UNIX slashes not DOS slashes.
2. When mk:@MSITStore: prefix is used the full path must be specified.

So the MS Web site example does not work for IE5 uses since it uses a DOS path.
http://msdn2.microsoft.com/en-us/library/ms644690.aspx



--------------------------------------------------------------------------------

Notes on Using ShowHelp()

window.ShowHelp("ms-its:ChmFile::/Topic.htm>MyWinDef"")

You can use topics and window type definition.
CHMFile can be local or web path. HTML Help 1.2 appears to require a fully qualified path.

ShowHelp() Documentation

http://msdn2.microsoft.com/en-us/library/ms536758.aspx

http://msdn2.microsoft.com/en-us/library/ms533027.aspx


--------------------------------------------------------------------------------
Calling an external HTML file from a CHM topic.I see there is an example of Linking to files outside a chm up on the HH web site.
http://msdn2.microsoft.com/en-us/library/ms644690.aspx

This seems to work well. When you open an external file, it is loaded in to the current HH window.
See also the Helpware.net external file example.

<p>
<SCRIPT Language="JScript">
function parser(fn) {
  var X, Y, sl, a, ra, link;
  ra = /:/;
  a = location.href.search(ra);
  if (a == 2)
    X = 14;
  else
    X = 7;
  sl = "\\";
  Y = location.href.lastIndexOf(sl) + 1;
  link = 'file:///' + location.href.substring(X, Y) + fn;
  location.href = link;
  }
</SCRIPT>
</p>

<p>
<a onclick="parser('test.htm')" style="text-decoration: underline;
color: green; cursor: hand">Link to test.htm</a>
</p>


--------------------------------------------------------------------------------

From: Ralph Walden <ralphw@EXMSFT.COM>
Subject: Re: Link from browser web to CHM
To: WINHLP-L@ADMIN.HUMBERC.ON.CA

Let's say you've got a link to something like: its:myfile.chm::/foo.htm

If you display that link within an HTML Help window, HH will go off and find the location of myfile.chm, turning the link into something like:
its:c:\somefolder\myfile.chm::/foo.htm

However, if you try that first link in the IE browser, it will fail because the browser doesn't know where myfile.chm is located. Somehow or other, you must tell the browser where the "myfile.chm" is located. You can do that with script (Jerry Mead posted a method a while back), you can hard-code the path, or you can install KeyFndHH (a free utility available on www.keyworks.net). The caveat with the latter method is that anytime you install HTML Help, it will blow away KeyFndHH requiring you to re-install it. So your safest method is to hard-code the path, and if that isn't possible, use script, and if that still doesn't work, then use KeyFndHH and make certain your user's know how to re-register it if HH blows it away.


--------------------------------------------------------------------------------

From: Rob Cavicchio <robert.cavicchio@stac.com>
Subject: showHelp documentation

I've got some more showHelp() info. that you might like to add to your
Web site. I was trying to use showHelp() from within a .CHM to link to
2 different files: (1) the .CHM that contained the file I was linking
from (so I could open a new instance of the same Help file), and (2) the
Internet Explorer Help file. Our file was included in the registry
under the normal ...Windows\HTML Help. In both cases I started with the
syntax "window.showHelp('HelpFile.chm');".

Here's what I found.

(1) To open another instance of the same .CHM file, you need to get the URL
and pass it back as a full path to showHelp(); e.g., "showHelp('c:/program
files/my program/my help.chm')". If you just specify the file it seems to
work from an uncompiled HTML file as long as it is registered, but it still
does not work from within the .CHM. In that case IE 4 SP 1 looks for the
.CHM that you try to link to *within* the .CHM that you link from, in the
same compiled folder that contained the HTML file; while IE 5 successfully
opens the file, but displays the "Page cannot be displayed" page.

(2) With IE 5, you can link to Internet Explorer Help with
"showHelp('iexplore.chm')" from all contexts.

(3) With IE 4.01 SP 1, you can link to IEXPLORE.CHM from an uncompiled
file but not from a compiled file, unless you know the full path to it.
(I tried using "file://iexplore.chm" and "mk:@MSITStore:iexplore.chm",
but neither one worked.)

Rob Cavicchio
Stac Software, Inc.
robert.cavicchio@stac.com


--------------------------------------------------------------------------------
Hi Trey

Work arounds... Mmmm... And hey its my pleasure to chat with you. This is bleeding edge stuff and it really helps if we can all share our ideas. Some of the things done so far MS never even imagined at the time of writing.

-------- Hope this does not bore you too much ------------

=== Have been playing <g>

I just took the help file hhaxref.chm and put it on the web
http://www.helpware.net/htmlhelp/hhaxref1.chm
128K

Next I made several small CHMs that call the above.
1 stays on web, 2.5 must be run locally (open or download).

== Play thing 1 ==

I made a copy of the chm and completely gutted it of
image and htm files. I made all the TOC links point to the
chm on the web.

http://www.helpware.net/htmlhelp/hhaxref2.chm
17K

Click the link above and select open. It opens quickly being small.
Click on the TOC items and initially it appears to lockup while it
downloads the entire CHM to the Cache. After that each link loads
quickly.

== Play thing 2 ==

http://www.helpware.net/htmlhelp/hhaxref3.chm
12K

I further guttered the chm so it contained only one TOC item
plus a merged file item pointing to the HHC in the big CHM on the web.

<OBJECT type="text/sitemap">
<param name="Merge" value="http://www.helpware.net/htmlhelp/hhaxref1.chm::\HHOCX_c.hhc">
</OBJECT>

It is is very quick to load only because the main CHM is already in the cache. From part 1. If you clear the cache first you will see nothing on screen for a minute or two while the TOC is pull off the web site - then the window suddenly appears and all topics are available.

== Play thing 3 ==

http://www.helpware.net/htmlhelp/hhaxref4.chm
12K

This simply defines a plain HH Window - no TOC.

http://www.helpware.net/htmlhelp/hhaxref5.chm
13K

Another test - simple TOC.

========================================================================

What have I learned

1. You cannot open a Web CHM from a HTML DOC but you can from another CHM.

2. You can make a small CHM to download or distribute, that calls
a larger web based CHM.

3. Web Based CHM are very crippled - Cannot see the Window Definitions
of a web based CHM. Thus -- all window definitions and TOC need to
be on the client side.

4. Merge web based HHC works OK. For Intranet the frozen download would
be quick and not so much a problem.

========================================================================

from:http://www.helpware.net/htmlhelp/linktochm.htm

分享到:
评论

相关推荐

    C# 调用chm文件

    3. **调用CHM文件的方法**:调用CHM文件的基本步骤如下: - 引入`System.Windows.Forms`命名空间。 - 创建一个`Help`对象。 - 使用`Help.ShowHelp`方法,传入窗体对象和CHM文件的完整路径。例如: ```csharp ...

    winform调用chm文件.txtwinform调用chm文件.txt

    在WinForms中,最直接的调用CHM文件的方式是通过`System.Windows.Forms.Help`类的`ShowHelp`方法。此方法接收两个参数:当前窗体和CHM文件的路径。示例如下: ```csharp string helpFile = "helpfile.chm"; Help....

    Delphi制作CHM联机帮助示例源码

    3. 加载CHM文件: - 在Delphi代码中,通过调用HHCtrl的`SetHelpFile`方法指定CHM文件路径,使HHActiveX控件加载CHM文件。原始代码有一个错误:`HHControlInstance := LoadLibrary(P);` 这行代码实际上是尝试加载...

    C#如何写帮助的例子

    可以使用`System.Windows.Forms.Help.ShowHelp`方法打开CHM文件,例如: ```csharp Help.ShowHelp(this, @"C:\path\to\your\help.chm"); ``` 7. **其他帮助格式**:除了CHM,还可以考虑使用Markdown或HTML5等...

    vb帮助代码实例

    Help.ShowHelp(Me, "path_to_help_file.chm", sender.HelpKeyword) End Sub ``` 在这个例子中,“Control”是需要关联帮助的控件,"path_to_help_file.chm"是CHM文件的路径,sender.HelpKeyword则对应了前面提到的...

    vb中调用CHM的两种方法及源代码 1.00

    4. 调用`ShowHelp`方法来打开CHM文件中的特定主题。例如: ```vb HelpViewer1.ShowHelp Nothing, "keyword" ``` 这里的`keyword`是CHM文件中的帮助主题关键词。 ### 方法二:利用Shell32库 **Shell32库** 提供...

    如何快速制作CHM帮助文件

    例如,在使用Visual Basic开发的应用程序中,可以通过`MSHelp.ShowHelp`函数来调用特定的CHM帮助页面,为用户提供即时帮助。 #### 结论 快速制作CHM帮助文件涉及多个步骤,从内容设计、HTML文件的创建到工程文件的...

    WPF使用 F1 打开帮助文档源代码

    private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F1) { // 执行打开帮助文档的操作 OpenHelp(); e.Handled = true; // 阻止事件冒泡 } } ``` `OpenHelp()`方法是关键...

    VB 调用帮助文件

    在VB代码中,你需要创建一个`HelpProvider`对象,它负责连接控件和帮助文件。例如: ```vb Dim hlp As New HelpProvider hlp.HelpFile = "path_to_your_chm_file.chm" '替换为你的CHM文件路径 ``` 3. **关联控件与...

    Extjs教程_第四章_按钮、菜单和工具栏(2)

    EXTJS提供了一系列的快捷方式来简化代码编写。例如,`tbfill`快捷方式表示一个工具栏填充器,用"-&gt;"表示,用于将后续组件推至工具栏最右侧。还有`separator`或"-"用于创建分隔符,`spacer`用于添加空白间隔,以及`...

    从数据库中导出到word、调用chm文件

    例如,在C#程序中,可以使用System.Windows.Forms.Help类的ShowHelp方法来打开指定的CHM文件。理解CHM文件的结构和索引机制,能帮助我们更有效地集成和使用此类资源。 再者,数据库的加密和解密对于保护敏感数据至...

    精彩编程与编程技巧-vb6如何把帮助文件加到设计的程序内...

    3. **了解基本的VB6语法**:虽然本文会尽量解释每一步操作,但对VB6的基本了解有助于更好地理解整个过程。 #### 三、步骤详解 ##### 3.1 创建新项目 打开Visual Basic 6,创建一个新的标准EXE项目。选择“文件”&gt;...

    How-to-call-the-help-file.rar_The Call

    在Windows操作系统中,调用帮助文件(通常是.chm格式)是开发者经常遇到的任务,用于提供程序的用户指南和文档支持。.chm文件是Microsoft HTML Help的格式,它将多个HTML页面、图像和其他资源组合成一个单一的可搜索...

    SetSoftInfo.rar

    在C#代码中,你可以通过System.Windows.Forms.Help.ShowHelp方法调用来显示帮助内容。 对于"SetSoftInfo"这个压缩包文件,可能是包含了一个C#项目的源代码示例,演示了如何在VS2008中设置这些信息的步骤,或者包含...

    C#记事本全部

    partial class ShowHelp { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// ...

    用VC6.0中开发HTML帮助文件C++源代码程序小实例

    在这个例子中,`ShowHelp`函数使用`HtmlHelp`函数打开名为"your_help_file.chm"的帮助文件。当程序运行时,调用`ShowHelp`函数即可显示帮助内容。 总之,通过VC6.0开发HTML帮助文件结合C++源代码,我们可以为软件...

    帮助文档 嵌入到程序 C#例子

    例如,我们可以创建一系列的HTML文件,然后将它们打包成一个.chm(Microsoft HTML Help文件)。 在Visual Studio中,可以按照以下步骤操作: 1. 打开你的C#项目,右键点击“解决方案资源管理器”中的“资源”...

    基于c#的图像处理源代码

    string strFilExtn = fileName.Remove(0, fileName.Length - 3); switch (strFilExtn) { case "bmp": curBitmap.Save(fileName, System.Drawing.Imaging.ImageFormat.Bmp); break; case "jpg": curBitmap....

    javaHelp3帮助文档3

    JavaHelp3是一个基于Java平台的帮助系统框架,它允许开发者创建和集成丰富的在线帮助系统到Java应用程序中。这个框架提供了一套完整的工具集,包括编辑器、编译器和查看器,使得开发人员能够轻松地组织和展示应用的...

    Designer中的QDialogButtonBox的accepted、rejected和helpRequested信号.rar

    3. 要连接信号到槽,选择“Signals/Slots”视图,找到对应的信号并双击,然后在弹出的对话框中选择你要连接的槽函数。 4. 在Python代码中,你需要将Qt Designer生成的.ui文件转换为.py文件,这可以通过`pyuic5`命令...

Global site tag (gtag.js) - Google Analytics