Solved

Problem with Application.HelpFile and ExtractFilePath(Application.ExeName)

Posted on 2002-04-19
3
310 Views
Last Modified: 2012-06-27
Hi experts,

In the *.dpr file of my application under construction there is this
line:

Application.HelpFile := 'C:\MyFiles\Programming\Projects\Sourcefiles\MyApp\MyApp.HLP';

I guess this code line has been created by the settings of my Delphi 6.0 Professional:

 Project/Options/Application/Helpfile

But actually I don't like this string constant. If I give my application to other users,
I can't be sure that they will install my application into the same directory as this is
the case on my PC.

And if my application is really installed to another directory, the code line above will
cause a run-time error, because the helpfile can't be found.

This is the reason why I try to code a more flexible solution.

I tried to accomplish my goal with this statement:

Application.HelpFile:= ExtractFilePath(Application.ExeName) + 'MyApp.HLP';

But as soon as I edit the *.dpr file, and make the described changes, I immediately get this error message:

Error in module myprogram: The Call of Application.CreateForm is missing or is not correct.

Do you know how I can solve this problem?  I think you will agree with me tzhat it is is really bad to assume that
the users of my program have the same directories on their computer. So I have to find a method to assign to path
to the help file dynamically. But obviously Delphi becomes rather angry, if anyone tries
to edit the project files.



0
Comment
Question by:mathes
  • 2
3 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6954431
do this
Application.HelpFile:= ExtractFilePath(Application.ExeName) + 'MyApp.HLP';

im the oncreate-event of your mainform

meikl ;-)
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 100 total points
ID: 6954443
or just left the path and write at
Project/Options/Application/Helpfile
only
MyApp.HLP

0
 

Author Comment

by:mathes
ID: 6956542
Dear Meikl,

thank you for your input. Your second idea works perfectly for me. I don't know if your other suggestion - changing
the OnCreate-event is applicaple. As far as I know a *.dpr file has no OnCreate-event.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question