Solved

Passing string path from installation program to exe application

Posted on 2003-11-28
6
193 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to open a new windows chrome resized and disabled the toolbar? 3 232
Magic Software info 18 154
Convert GUI app into console app for Win32 Env 5 137
SUM 2 INTEGER ARRAYS INTO 1 10 117
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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 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