Search code examples
delphidelphi-xe7helpfilewinhelp

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?


Solution

  • 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.