Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding the Directory of Exe
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00046135
Message ID:
00046230
Views:
23
>>I have two exe's. The first exe begins running, then it calls the second exe with a DO command. For example:
>>DO &path.commonrpt.exe WITH parameter1, parameter2
>>
>>I am trying to find a way the second program can locate itself so that I can tell it where to find an init file without any hard coding.
>>
>>When I use the GetCurrentDirectory() Win32Api call, it returns the path to the original calling program. If I run commonrpt.exe on its own this function works well.
>>
>>FULLPATH("commonrpt.exe") and LOCFILE("commonrpt") do not work because if the file is not found in the default or paths then it will either return the default directory with commonrpt.exe attached to the end or an open dialog box. Either the data is incorrect or the automatted process halts with a dialog box.
>>
>>I don't want to pass the path to the exe as a parameter of the DO command.
>>
>>Does anyone have any suggestions or solutions??
>>
>>Thank You,
>>Michael
>
>since you have the path in the exe, could you save the value of FULLPATH( "" ), set default to your path, call your exe, then set default back after the call. in the second exe, FULLPATH("" ) should return the correct dir.


The second exe called commonrpt.exe requires the default and the paths be untouched. Commonrpt.exe encapsulates the routines necessary to create and send reports via, printer, fax, or email. Because of this, the report needs access to the original default and paths. If I reset the default in commonrpt.exe then I am still requiring the user of this exe to add extra steps to their code.

Thanks for the suggestion.
Previous
Reply
Map
View

Click here to load this message in the networking platform