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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the Root or Application Directory (or sys

Status
Not open for further replies.

nytyme

Programmer
Jan 8, 2001
19
US
i have an INI file that needs to be in a specific directory (i'd like to avoid this) or in a relative directory to the EXE. I tried using GetCurrentDirectory() but that gives me the calling application's directory, not the EXE that uses GetCurrentDirectory(). ( i wrote an EXE that is called from other applications).

so, what i need to know is how do i get my application's directory, regardless of what calls it (shortcut, link, another exe). if this isn't possible, i'd settle for placing it in the root directory. i'd like to avoid the registry if possible, but i'll most likely give up and do that in about 2 hours.

thanks,
Nytyme

example:
i have MyApp.Exe and MyApp.ini in C:\MyApp, if i active MyApp.Exe from there everything is fine. if i click a link from an email, i want my application to launch (it does), but it looks for the INI file where my email app sits. this is where my error comes in. i know i can specify its location in the registry. but i'd like to use something programmatic so that it knows "if EXE is in this folder, then so is INI".

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top