可能的变通方法的HTMLHelp装错CHM文件?文件、方法、装错、HTMLHelp

2023-09-06 17:17:53 作者:佳丽万千朕只允诺一人

我显然是碰上的HTMLHelp这个bug,比2001年(他们没有固定的它,但至少证明它。)

I've apparently run into this bug in HTMLHelp, from 2001. (They haven't fixed it yet, but at least they documented it.)

BUG:HTMLHelp的()打开错误的帮助文件 http://support.microsoft.com/kb/267962/en-us

"BUG: HTMLHelp() Opens the Wrong Help File" http://support.microsoft.com/kb/267962/en-us

他们提出修正对我来说是重命名我的CHM文件。但我真的不想这样做。

Their suggested "fix" is for me to rename my CHM files. But I really don't want to do that.

还有更多的是在这里:同一CHM打开错误 HTTP://kb.helpwaregroup .COM / MS-HTML的帮助/ HH-FAQ#TOC-THE-同-CHM - 打开 - 错误

There's more about it here: "The Same CHM Opens Bug" http://kb.helpwaregroup.com/ms-html-help/hh-faq#TOC-The-Same-CHM-Opens-Bug

最简单的解决方法是打开每个CHM之前调用FreeLibrary(),然后调用LoadLibrary()的HHCTRL.OCX图书馆。

"The easiest fix is to call FreeLibrary() then LoadLibrary() on the HHCtrl.OCX Library before opening each CHM.

这第二个解决方案只能如果您的应用程序动态加载使用调用LoadLibrary的HH API(HHCTRL.OCX)。应用程序语言编写的,如VB其中静态加载API将无法做到这一点。

This second solution only works if your application dynamically loads the HH API (HHCtrl.OCX) using LoadLibrary. Applications written in languages such as VB which statically load the API wont be able to do this."

我的计划是.Net和我使用System.Windows.Form.Help.ShowHelp()。是否有可能可以通过某种方式卸载HHCTRL.OCX,例如用P / Invoke来作弊?任何其他建议?

My program is .Net, and I'm using System.Windows.Form.Help.ShowHelp(). Is it maybe possible to cheat by somehow unloading HHCtrl.OCX, for example with p/Invoke? Any other suggestions?

编辑:

要详细说明:有一个在HTMLHelp的一个已知的问题,微软已经承认在2001年,但从来没有抽时间去修复。

To elaborate: There is a known problem in HTMLHelp that Microsoft has acknowledged in 2001 but never got around to fixing.

在我来说,我有两个帮助文件,... \丹麦\指南Help.chm和... \英语\指南Help.chm。我的程序打开的一个或另一个取决于哪个语言的用户选择。问题是,如果用户显示帮助信息,然后切换语言,然后再次点击F1,程序试图打开其他帮助文件,但有助于支持code将重新打开previously开帮助文件代替。

In my case I had two help files, "... \Danish\Help.chm" and "... \English\Help.chm". My program opens one or the other depending on which language the user has selected. The problem is that if the user displays help info, then switches languages, and then hits F1 again, the program tries to open the other help file but the help support code re-opens the previously-opened help file instead.

有一个已知的解决方法,但对我来说,它看起来就像是只适用于C ++程序,我的计划是.NET。所以我要问,如果有人知道如何在变通,或者一些其他的修复,适用于一个.net程序。

There is a known work-around, but to me it looks like it is only applicable to C++ programs, and my program is .Net. So I'm asking if anyone knows how to apply that work-around, or some other fix, to a .Net program.

推荐答案

这可能是有点激烈,但我落得这样做是推出一个新的Windows程序时,我想显示一个CHM帮助文件。这种微小的处理程序是一个WinForms方案,但它不显示它的形式。它只是包含了Help.ShowHelp(这一点,chmFileName);声明在其构造。 (文件名作为参数传递到微小的帮助文件处理程序。)

This may be a bit drastic, but what I ended up doing was launching a new Windows process when I want to display a CHM help file. The tiny process program is a WinForms program, but it does not display its form. It just contains the "Help.ShowHelp(this, chmFileName);" statement in its constructor. (The file name is passed as an argument to the tiny help file process program.)

作为一个不幸的副作用,甚至在用户已关闭帮助窗口的过程住上。但我开始一个新的前终止该进程,当我的主程序是逼抢。

As an unfortunate side-effect, the process lives on even after the user has closed the help window. But I do kill the process before starting a new one, and when my main program is closing down.