Pregunta

How call help from chm files in Delphi 7 program?

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

result is

Why can't I get Help from this program?

The Help for this program was created in Windows Help format, which depends on a feature that isn't included in this version of Windows. However, you can download a program that will allow you to view Help created in the Windows Help format.

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

¿Fue útil?

Solución

The problem is that Delphi 7, by default, assumes that help files use the old WinHelp format that was not shipped with Vista. Even though your help file has the .chm extension, Delphi tries to show it using WinHelp commands. And since WinHelp isn't there, you get the error message that you reported.

There are various ways to get the help system to show HTML help. For example, a common technique is to implement an OnHelp handler for the Application object and route the help to calls to the HtmlHelp API. I gave a very simple example of that in a recent answer.

Otros consejos

To open CHM file I use the following code:

    ShellExecute(Handle, 'open', PChar(ExtractFilePath(Application.ExeName) + 'help.chm'), nil, nil, SW_SHOW);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top