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

浪子不回头ぞ 提交于 2019-12-06 04:58:28

问题


Delphi - How to use CHM HTML Help file with Delphi XE application?

http://edn.embarcadero.com/article/27842 article describes how to use CHM file. 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`

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

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

On the button1 OnClick event added the following code:

HH(0, 0, dummy);

After clicking on the button1, cursor becomes an hourglass for a while, and that's all.

What I'm doing wrong ?

And how the CHM help file can be used from DelphiXE application?


回答1:


The article you are working from pre-dates built in support for HTML help. These days you do the following:

  • Include HtmlHelpViewer in at least one of your uses clauses.
  • Set Application.HelpFile to the path of your help file.

And that's it. The code in your question should be removed. The built-in help viewer takes care of all those details.



来源:https://stackoverflow.com/questions/21534449/how-to-use-chm-html-help-file-with-delphi-xe-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!