Link to home
Start Free TrialLog in
Avatar of michaenh
michaenh

asked on

Passing string path from installation program to exe application

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
Avatar of andrewjb
andrewjb
Flag of United Kingdom of Great Britain and Northern Ireland image

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 (!)
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
Avatar of michaenh
michaenh

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of andrewjb
andrewjb
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks! :)

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

cheers,
mha
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;