Building a Help System for Delphi Applications - Creating the MAP File
(Page 4 of 4 )
The last file that we need to create is the MAP file. This file basically contains numerical references to your topic and will be used by Delphi to show the right topics when the user selects a topic. So open up notepad or any simple text editor and add the following:
#define IDH_HOWTOCREATEHELPFILE1 100
#define IDH_BEGINNING1 200
#define IDH_HOWTOCREATEHELPFILE2 300
#define IDH_HOWTO2 400
Save the file as MyProject.MAP. It is very important that the .map extension is there, so make sure that it is. Next, we need to add the file to our project, so open up your help project (.hpj file) and click on the "map" button. A new window should pop up with four buttons on the side. Click on "add" and navigate to where you saved your map file. Select it and press OK. You should now be returned to the main window.
Next we need to define the type of window in which your help program is going to appear. Here we define the width, height and name of the window. So click on the "windows" button and click on "Add." Enter "MAIN" as the type of window and where it says "based on this Standard Window" leave it as "Procedure." Click OK and you should now be back to the "Windows Properties" dialog box. Enter the following text where it says "title bar text:"
Project Help File
and then select the "Keep Help Window on top" option. Your "Windows Properties Dialog Box" should look something like this:

Click OK and you should now be returned to the main window, which should look something like this:

Now all that is left is compiling the project. So click on "save and compile" and you should now have a help file in the folder in which you saved your original help project.
Linking Help File to Application
To link your newly created help file to your application, simply copy the .hlp file (your help file) to the same directory as your exe. And then on the OnformCreate event handler of your application add the following code (assuming that your help file is called "myhelpfile.hlp"):
Application.helpfile:='myhelpfile.hlp';
To launch the help file from within your menu item or from a button, add the following code:
application.helpcommand(HELP_CONTENTS,0);
That's it! You will now have a fully functioning help system for your project.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |