Solved

Passing string path from installation program to exe application

Posted on 2003-11-28
6
190 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 12

Accepted Solution

by:
andrewjb earned 50 total points
Comment Utility
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
Comment Utility
Thanks! :)

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

cheers,
mha
0
 

Expert Comment

by:thegetta
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now