Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

autostarting application in specific directory

Status
Not open for further replies.

dima2

Programmer
Jan 20, 2002
85
0
0
LB
Hi,
I'm developping an application and I'm trying to make it run
automatically when windows starts.
I added a value in the registry
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
where I specified the whole path of the executable
c:\Program Files\MyApp\MyExe.exe

It worked fine, the application started when windows started, now my
problem is
that it didin't start in it's directory
it started in c:
however I need it to start in c:\Program Files\MyApp (i want this to
be my working directory)

Is there a way to force it to start in a specific directory??
(you know, just like in a shorcut properties where u get to secify the
"target" and the "start in")

how can I do that??
 
I know no way to do that.

But if your problem is that your program doesnt find the files it needs to run, I see 2 solutions :

- store in the registry the location where your program is installed. eg an 'installpath' value in HKLM/Software/YourApp, so the program can retrieve it

- or get read the first command line argument (numbered 0, argv[0] in ansi C) your program receives from the system. It is always the full path to the executable (including filename).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top