I am building a standalone ap with vfp9. I want the exe to find a set
of free tables in the directory where it is run from. I know I can
hard code a set of tables into the project. The exe finds them from
where ever it is run. But that file set won't be where the exe
expects to find them after being put in place by a program installer
on a user's machine.

My thought was that there would be a way for the program to tell
itself where it is (like app.path in vb). I have found home() and a
set of sys() functions that provide a lot of paths, but, as far as I
can tell, none of them will tell the program what directory it was
started from. Yes, the program can find the Windows current
directory, but that won't necessarily be the same thing.

Is there a way to for a vfp exe to find out where it is?

Noah Sombrero

Re: program location by Noah

Noah
Sat May 20 23:28:24 CDT 2006

On Sat, 20 May 2006 20:35:42 -0400, Noah Sombrero
<sombrero@bluebottle.com> wrote:

>
>I am building a standalone ap with vfp9. I want the exe to find a set
>of free tables in the directory where it is run from. I know I can
>hard code a set of tables into the project. The exe finds them from
>where ever it is run. But that file set won't be where the exe
>expects to find them after being put in place by a program installer
>on a user's machine.

I see the above is not quite correct. The exe was finding the tables
because I had them as included files. If I exclude them, the exe
finds them when they are in the program directory, unless the Windows
default directory is somewhere else.

The installer can set the shortcut working directory to be the program
directory. The odds of the exe being started while the working
directory is somewhere else is small, but I know that if there is a
way for things to go wrong, users will find it.

Noah Sombrero

Re: program location by Bernhard

Bernhard
Sun May 21 03:56:35 CDT 2006

Hi Noah,

> My thought was that there would be a way for the program to tell
> itself where it is (like app.path in vb).
I think, JustPath(_vfp.FullName) is the info you need.

Regards
Bernhard Sander

Re: program location by AA

AA
Sun May 21 07:49:48 CDT 2006

_VFP.Fullname returns the location and name of the runtime dll. It can be in
anywhere on the same computer or ther cleint's and pointed to in the
Registry, or it can be in working directory of your EXE.
_VFP.Servername returns the location and name of the execiting EXE. However,
if you executing exe is launched by another VFP EXE, with DO.MyApp.exe, then
_VFP.Servername points to the launching EXE. The current EXE's path and name
can then be retrieved with SYS(16) if placed in the startup Main program
included in the EXE.
-Anders

"Bernhard Sander" <fuchs@individsoft.de> skrev i meddelandet
news:Ol5i5RLfGHA.2188@TK2MSFTNGP04.phx.gbl...
> Hi Noah,
>
>> My thought was that there would be a way for the program to tell
>> itself where it is (like app.path in vb).
> I think, JustPath(_vfp.FullName) is the info you need.
>
> Regards
> Bernhard Sander



Re: program location by Noah

Noah
Sun May 21 09:54:21 CDT 2006

On Sun, 21 May 2006 14:49:48 +0200, "AA" <A@A> wrote:

>_VFP.Fullname returns the location and name of the runtime dll. It can be in
>anywhere on the same computer or ther cleint's and pointed to in the
>Registry, or it can be in working directory of your EXE.
>_VFP.Servername returns the location and name of the execiting EXE. However,
>if you executing exe is launched by another VFP EXE, with DO.MyApp.exe, then
>_VFP.Servername points to the launching EXE. The current EXE's path and name
>can then be retrieved with SYS(16) if placed in the startup Main program
>included in the EXE.

Yes, that works. Thanks.

Noah Sombrero

Re: program location by Cindy

Cindy
Sun May 21 18:55:44 CDT 2006

Hi Noah,

Just to add, if you don't have the special circumstances of one app calling
another you can use Sys(5) + Sys(2003) to see where the current directory
is. There's a wealth of useful stuff in the Sys() Functions topic in Help.


--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy_winegarden@msn.com www.cindywinegarden.com


"Noah Sombrero" <sombrero@bluebottle.com> wrote in message
news:qmv072lao158qhdv16rj7ohk8e4fi71o5b@4ax.com...
> On Sun, 21 May 2006 14:49:48 +0200, "AA" <A@A> wrote:
>
>>....The current EXE's path and name can then be retrieved with SYS(16) if
>>placed in the startup Main program
>>included in the EXE.
>
> Yes, that works. Thanks.