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?

Recommended Answers

All 7 Replies

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

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.

Are you using ShellExecute() ??

Are you using ShellExecute() ??

Found the solution:
GetModuleFileName() ;

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

Found the solution:
GetModuleFileName() ;

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

What are the parameters or returns ??

bah I got it fixed, no worries.

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" :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.