Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use a hlp file for context sensitive help in my application?

I have a .hlp file that goes with the application.
Because the functionality has not changed since I last wrote the app the hlp (written in 2003) is still valid.
However when I compile the app in Delphi XE7 I cannot get the application to recognose the hlp file.

In the .dpr file I have

begin
  Application.Initialize;
  Application.HelpFile := 'Life32.hlp';
  Application.Run;
  //sometimes the application hung here, due to OLE issues
  //exitprocess prevents that.
  ExitProcess(0);
end.

When I do

procedure TProgCorner.Button2Click(Sender: TObject);
begin
  Application.HelpContext(4);
end;

I get

First chance exception at $75EEB9BC. Exception class EHelpSystemException with message 'No context-sensitive help installed'.

The helpfile property of the form is set to exename.hlp.
Manually double-clicking on the .hlp file in explorer opens the hlp file just fine.

How do I get Delphi to open the hlp file when called upon?

like image 411
Johan Avatar asked Jul 06 '16 16:07

Johan


2 Answers

You must include the Vcl.WinHelpViewer unit in your project for the WinHelp system to be installed.

Be warned that WinHelp support ended at XP and on later versions the WinHelp component must be installed separately.

like image 84
David Heffernan Avatar answered Sep 18 '22 23:09

David Heffernan


For later versions of Delphi like 10 (Seattle), 10.1 (Berlin), 10.2 (Tokyo), 10.3 (Rio) and 10.4 (Sydney):

  • If your help file is a WinHelp .hlp file, add the Vcl.WinHelpViewer unit to the application's uses clause.
  • If your help file is an HTML Help .chm file, add the Vcl.HtmlHelpViewer unit instead of the Vcl.WinHelpViewer unit.

You should not add both units to the same application.

The full article: HelpScribble’s HelpContext Property Editor

like image 26
pyfyc Avatar answered Sep 18 '22 23:09

pyfyc