How to use chm in Delphi 7?

How to call help from chm files in Delphi 7?

Application.HelpFile := 'd:\help.chm'; Application.HelpCommand(HELP_CONTEXT, 10); 

result

Why can't I get help from this program?

The help for this program was created in the Windows help format, which depends on a feature that is not included in this version of Windows. However, you can download a program that allows you to view help created in Windows help format.

For more information, go to the Microsoft Help and Support website.

+4
source share
2 answers

The problem is that Delphi 7 by default assumes that help files use the old WinHelp format, which was not sent with Vista. Even if your help file has a .chm extension, Delphi tries to display it using WinHelp commands. And since WinHelp does not exist, you get the error message that you reported.

There are various ways to make the help system display HTML help. For example, a general method is to implement an OnHelp handler for an Application object and route help to HtmlHelp API calls. I gave a very simple example of this in a recent answer.

+6
source

To open a CHM file, I use the following code:

  ShellExecute(Handle, 'open', PChar(ExtractFilePath(Application.ExeName) + 'help.chm'), nil, nil, SW_SHOW); 
0
source

Source: https://habr.com/ru/post/1469210/


All Articles