Solved

Passing string path from installation program to exe application

Posted on 2003-11-28
6
191 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
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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 12

Accepted Solution

by:
andrewjb earned 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 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