简体   繁体   English

如何在Delphi XE应用程序中使用CHM HTML帮助文件?

[英]How to use CHM HTML Help file with Delphi XE application?

Delphi - How to use CHM HTML Help file with Delphi XE application? Delphi - 如何在Delphi XE应用程序中使用CHM HTML帮助文件?

http://edn.embarcadero.com/article/27842 article describes how to use CHM file. http://edn.embarcadero.com/article/27842文章介绍了如何使用CHM文件。 I did all the steps described there. 我做了那里描述的所有步骤。

Added 添加

const
  HH_DISPLAY_TOPIC        = $0000;
  HH_DISPLAY_TOC          = $0001;
  HH_CLOSE_ALL            = $0012;

function HtmlHelp(hwndCaller: HWND;
  pszFile: PChar; uCommand: UINT;
  dwData: DWORD): HWND; stdcall;
  external 'HHCTRL.OCX' name 'HtmlHelpA';

and public function HH` 和公共职能HH`

function TForm1.HH(Command: Word; Data: Integer;
  var CallHelp: Boolean): Boolean;
begin
  if (Command = 0) and (Data = 0) then
      HtmlHelp(Application.Handle,
        PChar(Application.HelpFile),
        HH_DISPLAY_TOC, 0);

  CallHelp := False;
end;

In FormCreate 在FormCreate中

  HelpDir:=ExtractFilePath(Application.EXEName);
  Application.HelpFile:=HelpDir+'Sample.chm';
  Application.OnHelp := HH;

On the button1 OnClick event added the following code: 在button1 OnClick事件上添加了以下代码:

HH(0, 0, dummy);

After clicking on the button1, cursor becomes an hourglass for a while, and that's all. 点击button1后,光标会变成沙漏一段时间,而这就是全部。

What I'm doing wrong ? 我做错了什么?

And how the CHM help file can be used from DelphiXE application? 以及如何从DelphiXE应用程序中使用CHM帮助文件?

The article you are working from pre-dates built in support for HTML help. 您在早期工作的文章内置支持HTML帮助。 These days you do the following: 这些天你做了以下事情:

  • Include HtmlHelpViewer in at least one of your uses clauses. 在至少一个HtmlHelpViewer子句中包含HtmlHelpViewer
  • Set Application.HelpFile to the path of your help file. Application.HelpFile设置为帮助文件的路径。

And that's it. 就是这样。 The code in your question should be removed. 您的问题中的代码应该被删除。 The built-in help viewer takes care of all those details. 内置的帮助查看器负责处理所有这些细节。

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

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