Solved

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

Posted on 2002-04-19
3
301 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now