Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing string path from installation program to exe application

Posted on 2003-11-28
6
Medium Priority
?
195 Views
Last Modified: 2010-04-05
Hi

Ok. Here is the question:
I want to send a path of an old ini file from my installation program to my exe application.
How can I do that?

One way is to write the path to windows register or to text files that my exe application can pick up. But I do not want to this.

Are there other ways? With ShellExecute and parameter passing maybe?

cheers,
mha
0
Comment
Question by:michaenh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 12

Expert Comment

by:andrewjb
ID: 9837279
Is this for a one-off at install time? Just call the application and pass as a commad-line parameter, then check for that in the Delphi app via CommandString() or CmdString or whatever it's called (!)
0
 
LVL 6

Expert Comment

by:CyberGhost
ID: 9837301
Not a bad idea but be sure you use ExtractShortPathName() to pass that parameter because sometimes Windows thinks that in f.e. "C:\Program Files\Application" is the "C:\Program" first and "Files\Application" second parameter so you will get an error message with "File Does Not Exist".

regards
CyberGhost
0
 

Author Comment

by:michaenh
ID: 9837451
Hi

>Is this for a one-off at install time?

Yes it is.. I have know just call the application and pass as a commad-line parameter..
How do I call it in Delphi app via CommandString() or CmdString?

Many thanks

cheers,
mha
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 12

Accepted Solution

by:
andrewjb earned 200 total points
ID: 9837501
Use the installer to call your application, passing the ini file path as a parameter.

Then, inside Delphi, in something like the OnFormShow event of the main form, use ParamCount to see whether there are any command-line parameters, and ParamStr to fetch them. Then you can look for the ini file supplied etc.

(Sorry it's not CommandString() - ParamCount and ParamStr are what you need. That'll teach me for not looking it up. They're in the help)

0
 

Author Comment

by:michaenh
ID: 9837665
Thanks! :)

Thats why you got me confused...  CommandString()/CmdString??.. smile.. :)

cheers,
mha
0
 

Expert Comment

by:thegetta
ID: 9843627
Hi,
you
could run run application like that
filename /ini.file

and in your application you can access the file like that
var
filename:string;
begin
// paramstr(1) = /ini.file
// so we need to remove the "/"
filename := copy(paramstr(1), 2, 255);
end;
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

719 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