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

2

6

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?

Ritzy answered 6/7, 2016 at 16:55 Comment(0)
J
6

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.

Jayme answered 6/7, 2016 at 17:9 Comment(3)
on later versions the WinHelp component must be installed Installed in Windows as a separate download from MS? or installed in the delphi IDE? I don't know because on my W7 system it just worked out of the box. BTW WinHelpViewer and the following tweak fixed the issue: Application.HelpFile := ExtractFilePath(Application.ExeName)+'Life32.hlp';Ritzy
Nothing to do with the ide. Its a download from MS. You'll have installed it already on your Win7 box.Jayme
There is a modified install script which will install winhelp on Win10. See answers.microsoft.com/en-us/windows/forum/… and scroll till you find the name 'Bahampour'Flogging
C
1

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

Cheng answered 17/9, 2021 at 6:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.