954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Another Program Launching mine

Another Program needs to launch my program, but for some reason becuase its lauching it, my program looks for all the required dlls and program files with in the direcotry of the program launching it. I do not want this, and despertly need a fix, any suggestions?

Additionally, is their a way to find my program's location, regardless of which program is launching it and where it's launched from?

BountyX
Posting Whiz in Training
230 posts since Mar 2004
Reputation Points: 28
Solved Threads: 9
 

Now this is something which depends on you.If you want you can store all the dll in some specific folder and when the program is launced open those file with the absolute paths.

If your program is DOS the you can look in argv[0] for the full path.
eg.c:\sdd\path\yourprogram.exe is what is there.

int main(int arg,char **argv)
{
       cout<<argv[0];
       return 0;
}


yea there are some standard headers which provide funtions to splitup the path into various componets but if need them tell me and i will look it up

FireNet
Posting Whiz in Training
258 posts since May 2004
Reputation Points: 108
Solved Threads: 7
 

couldn't you just have the installer create a txt or dat file at 'c:\proglocate.dat' that has the path to the program in it? then when running the program just open proglocate.dat & run the correct file.

Natso
Junior Poster in Training
51 posts since May 2004
Reputation Points: 10
Solved Threads: 1
 

Are you using ShellExecute() ??

FireNet
Posting Whiz in Training
258 posts since May 2004
Reputation Points: 108
Solved Threads: 7
 
Are you using ShellExecute() ??

Found the solution:
GetModuleFileName() ;

First module is always the current process, includes path and various other details.

BountyX
Posting Whiz in Training
230 posts since Mar 2004
Reputation Points: 28
Solved Threads: 9
 
Found the solution: GetModuleFileName() ; First module is always the current process, includes path and various other details.


What are the parameters or returns ??

FireNet
Posting Whiz in Training
258 posts since May 2004
Reputation Points: 108
Solved Threads: 7
 

bah I got it fixed, no worries.

BountyX
Posting Whiz in Training
230 posts since Mar 2004
Reputation Points: 28
Solved Threads: 9
 
bah I got it fixed, no worries.

What'd you end up doing?

I know this isn't something that would concern me too much, but for posterity, perhaps others would like to know. Besides, it would let us mark the thread as "solved" :)

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You