简体   繁体   中英

How to use chm in Delphi 7?

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.

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 .

要打开CHM文件,请使用以下代码:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM