Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2002-04-19
3
Medium Priority
?
338 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 400 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 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