简体   繁体   English

如果在.chm文件(html帮助)中两次描述了AKeyword,则Delphi XE2的应用程序将冻结

[英]If AKeyword is described on .chm file (html help) twice the application for Delphi XE2 freezes

We are using the following code to call html help by A-links on the application for Delphi XE2: 我们正在使用以下代码通过Delphi XE2应用程序上的A-links调用html帮助:

var
  aLink: THH_AKLink;
begin
  ZeroMemory(@aLink, SizeOf(aLink));
  aLink.cbStruct := SizeOf(aLink);
{$WARNINGS OFF}
  aLink.pszKeywords := PChar(AnsiString(AKeyword));
{$WARNINGS ON}
  aLink.fIndexOnFail := False;
  HtmlHelpW(Handle, Application.HelpFile, HH_ALINK_LOOKUP, DWORD_PTR(@aLink))
end;

But if AKeyword is described on .chm file twice the application freezes (hangs). 但是,如果在.chm文件中两次描述了AKeyword则应用程序将冻结(挂起)。 It seems something wrong on Delphi or system libraries. 在Delphi或系统库上似乎有问题。 But how to fix this issue on the application? 但是,如何在应用程序上解决此问题?

Thanks a lot for the help! 非常感谢您的帮助!

You're adding twice into a compiled chm file with a third party application 2 equal ALink . 使用第三方应用程序2 ALink 将两次添加到已编译的chm文件中

Then you give Delphi XE2 the blame when the chm file is not working as expected? 然后,当chm文件未按预期工作时,您应该责怪Delphi XE2吗?

1.) You can not use AKeyword with 1.)您不能将AKeyword与

HtmlHelpW(Handle, Application.HelpFile, HH_ALINK_LOOKUP, DWORD_PTR(@aLink))

you can try it with a KLink Keyword: 您可以使用KLink关键字进行尝试:

HtmlHelpW(Handle, Application.HelpFile+'>main', HH_DISPLAY_TOPIC, DWORD_PTR(nil));
HtmlHelpW(Handle, Application.HelpFile, HH_KEYWORD_LOOKUP, DWORD_PTR(@link));

ALink is a jump from his appearance here, as well as a KLink display or jump in Related Topics. ALink是他在此处的外观以及KLink显示或“相关主题”中的跳转。

The list of topics found, however, is not based on keywords from the index, but on ALink names that were involved in the .htm file. 但是,找到的主题列表不是基于索引中的关键字,而是基于.htm文件中涉及的ALink names

This can be used only with ALinks. 这只能与ALinks一起使用。 The following is a ALink. 以下是ALink。

part of a xy.htm xy.htm的一部分

<Object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
    <param name="ALink Name" value="UsingtheMenus">
</OBJECT>

2.) In your code I can not see following: 2.)在您的代码中,我看不到以下内容:

HtmlHelpW(Handle, Application.HelpFile, HH_DISPLAY_TOPIC, DWORD_PTR(nil));
  • You must first call the HH_DISPLAY_TOPIC command before calling HH_ALINK_LOOKUP , to ensure that the help window is created. 必须先调用HH_DISPLAY_TOPIC命令,然后再调用HH_ALINK_LOOKUP ,以确保创建了帮助窗口。

HH_ALINK_LOOKUP command HH_ALINK_LOOKUP命令

  • Help authors insert ALink names into target topic files using the HTML Help Compiler Information feature. 帮助作者使用HTML帮助编译器信息功能将ALink名称插入目标主题文件。
  • ALink : name="ALink Name" value="lookupAlink" ALink:name =“ ALink名称” value =“ lookupAlink”
  • KLink : name="Keyword" value="lookupKeyword" KLink:name =“ Keyword” value =“ lookupKeyword”

lookups are case sensitive. 查找区分大小写。 Multiple lookups are delimited by a semicolon. 多个查找用分号分隔。

Besides automatically generated keywords, when compiling a .htm source file . 除了自动生成的关键字外,在编译.htm源文件时。

在此处输入图片说明

Can you use an explicit KLink. 您可以使用显式的KLink吗?

This is an explicit "KLink" the place may be anywhere in a .htm file, used for Keywords 这是一个显式“ KLink”,该位置可能位于.htm文件中的任何位置,用于“关键字”

<Object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
    <param name="Keyword" value="lookupKeyword">
</OBJECT>

The beneficial if you have a Error Message is created, the error is displayed and the Application continues normally. 如果创建了错误消息,则显示错误,并且应用程序可以正常继续,这很有用。 Source from answer How to add support of HTML help files (.chm).... 来自答案的来源如何添加对HTML帮助文件(.chm)的支持。

procedure TForm1.HHALINKLOOKUPClick(Sender: TObject);
var
link : HH_AKLINK;
szUrl,szKey,szMsgText,szMsgTitle,szWindow : AnsiString;
begin
   szKey      := Edit1.Text; // 'UsingtheMenus';
   szUrl      :='Overview.htm';
   szMsgText  :='Error: Can''t find "'+Edit1.Text+'"!';
   szMsgTitle :='Error: HH_ALINK_LOOKUP';
   szWindow   :='main';

   with link do begin
   cbStruct    := sizeof(HH_AKLINK) ;
   fReserved   := False;
   pszKeywords := PChar(szKey);
   pszUrl      := nil;
   pszMsgText  := PChar(szMsgText);
   pszMsgTitle := PChar(szMsgTitle);
   pszWindow   := PChar(szWindow);
   fIndexOnFail:= False;
   end;
   HtmlHelpW(Handle, Application.HelpFile+'>main', HH_DISPLAY_TOPIC, DWORD_PTR(nil));
   HtmlHelpW(Handle, Application.HelpFile, HH_ALINK_LOOKUP, DWORD_PTR(@link));
end;

And that do you get when you ALink "UsingtheMenus" calls without last letter "s". 当您使用ALink“ UsingtheMenus”调用而没有最后一个字母“ s”时,您会得到这些。

在此处输入图片说明

Test your : with 3rd party application changed chm file 测试您的:用第3方应用程序更改的chm文件

You can test any .chm file with HTML Help Workshop 您可以使用HTML帮助工作室测试任何.chm文件

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

当前最好的答案是删除CHM文件上所有重复的A链接,并确保其中没有重复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM