Thursday 30 January 2014

How to load Help File (.chm file) in your Delphi Project using HTMLHelpViewer?

How to load Help File (.chm file) in your Delphi Project using HTMLHelpViewer?

Having the help option in your Delphi project is very common in which you want to load the chm file. If you want to create such a functionality in your project, here is the solution. It is very simple in Delphi. Following are the steps which you require to implement help functionality in your Delphi Project.

1. Create a valid chm file and place it in a directory where your exe is placed.

2. Include a unit "HTMLHelpViewer" under your uses section. HTMLHelpViewer is needed to register a viewer for HTML help.

3. On the click of help menu button, put the following code:

procedure TMyForm.ExecuteHelp(Sender: TObject);
  If Application.HelpFile <> '' then
    Messagedlg('Cannot load help file');

Application.HelpFile fetches the exact address of your chm file. Application.HelpCommand(HELP_CONTEXT,100) loads your chm file in your Delphi project.

I think this simple tutorial will be useful to you for creating help file in your Delphi project.

No comments:

Post a Comment

About the Author

I have more than 10 years of experience in IT industry. Linkedin Profile

I am currently messing up with neural networks in deep learning. I am learning Python, TensorFlow and Keras.

Author: I am an author of a book on deep learning.

Quiz: I run an online quiz on machine learning and deep learning.