mathes
asked on
Problem with Application.HelpFile and ExtractFilePath(Application.ExeName)
Hi experts,
In the *.dpr file of my application under construction there is this
line:
Application.HelpFile := 'C:\MyFiles\Programming\Pr ojects\Sou rcefiles\M yApp\MyApp .HLP';
I guess this code line has been created by the settings of my Delphi 6.0 Professional:
Project/Options/Applicatio n/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(Applicatio n.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.
In the *.dpr file of my application under construction there is this
line:
Application.HelpFile := 'C:\MyFiles\Programming\Pr
I guess this code line has been created by the settings of my Delphi 6.0 Professional:
Project/Options/Applicatio
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(Applicatio
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
Application.HelpFile:= ExtractFilePath(Applicatio
im the oncreate-event of your mainform
meikl ;-)