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

chm, delphi, delphi-xe, html-help

Solution

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.

Problem

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?

Original source

Related problems