"Program Files" location  
Author Message
flkeys





PostPosted: Sat Jun 12 18:48:34 CDT 2004 Top

Exchange Servers >> "Program Files" location

How can I find out the name and location of the Program Files folder from
witin my VFP app?

I've had a look at...

Declare Integer SHGetSpecialFolderPath in Shell32.dll ;


...but can't seem to find a parameter that will return Program Files
location.

Thanks,

Brian

Exchange Server21  
 
 
Dan





PostPosted: Sat Jun 12 18:48:34 CDT 2004 Top

Exchange Servers >> "Program Files" location Depends on your version of Windows, I'd imagine.

This gets it for me with Windows2000. Seems to work in WinXP too.

?GetEnv("programfiles")

Dan


> How can I find out the name and location of the Program Files folder
> from witin my VFP app?
>
> I've had a look at...
>
> Declare Integer SHGetSpecialFolderPath in Shell32.dll ;

>
> ...but can't seem to find a parameter that will return Program Files
> location.
>
> Thanks,
>
> Brian


 
 
Wolfgang





PostPosted: Sat Jun 12 18:52:18 CDT 2004 Top

Exchange Servers >> "Program Files" location Try
lcProgFiles= GETENV("ProgramFiles")

--
----------------------------------------------

Mit freundlichen Grüßen

Wolfgang Schmale

[MVP für Visual FoxPro]

--------------------------------------------


> How can I find out the name and location of the Program Files folder from
> witin my VFP app?
>
> I've had a look at...
>
> Declare Integer SHGetSpecialFolderPath in Shell32.dll ;

>
> ...but can't seem to find a parameter that will return Program Files
> location.
>
> Thanks,
>
> Brian
>
>


 
 
Brian





PostPosted: Sat Jun 12 19:22:34 CDT 2004 Top

Exchange Servers >> "Program Files" location Dan, Wolfgang,

Thanks, but no good under Win 98.

This is for a commercial app, so I have to cover all Win versions.

Regards,

Brian



> Depends on your version of Windows, I'd imagine.
>
> This gets it for me with Windows2000. Seems to work in WinXP too.
>
> ?GetEnv("programfiles")
>
> Dan
>

> > How can I find out the name and location of the Program Files folder
> > from witin my VFP app?
> >
> > I've had a look at...
> >
> > Declare Integer SHGetSpecialFolderPath in Shell32.dll ;

> >
> > ...but can't seem to find a parameter that will return Program Files
> > location.
> >
> > Thanks,
> >
> > Brian
>
>


 
 
Eric





PostPosted: Sun Jun 13 03:47:34 CDT 2004 Top

Exchange Servers >> "Program Files" location Hello, Brian!

Sorry, no Windows 98 here to test but see if there is a ProgramFilesDir
registry key under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8


 
 
Gregory





PostPosted: Sun Jun 13 04:34:47 CDT 2004 Top

Exchange Servers >> "Program Files" location Brian,

this works as well

?ExpandEnvStrings('%ProgramFiles%')
*---------------------------------------------------------------------------
function ExpandEnvStrings(s)

declare integer ExpandEnvironmentStrings in Kernel32.dll ;

expanded string

local i, s1
s1 = space(1024)


return left(m.s1, m.i-1)
endfunc
*--------------------------------------------------------------------------

Gregory
_____________________________________________________


> How can I find out the name and location of the Program Files folder from
> witin my VFP app?
>
> I've had a look at...
>
> Declare Integer SHGetSpecialFolderPath in Shell32.dll ;

>
> ...but can't seem to find a parameter that will return Program Files
> location.
>
> Thanks,
>
> Brian
>
>

 
 
Rick





PostPosted: Mon Jun 14 09:57:46 CDT 2004 Top

Exchange Servers >> "Program Files" location Brian,
Eric is right - it's in the registry. I just tried this with VFP 9.0 =
beta on XP and VFP 5.0 on Win98SE.
?progfilesdir()

Rick

*progfilesdir.prg
#define HKEY_LOCAL_MACHINE -2147483646 && bitset(0,31)+2
PRIVATE lcProgramFilesDir, lcRegClass, lcRegProg, llUseClass

lcRegClass =3D home()+"ffc\registry"=20
lcRegProg =3D "registry" && 6.0+ use _samples+"classes\registry"
llUseClass =3D FILE(lcRegClass)
IF llUseClass
set classlib to (lcRegClass) ADDITIVE
ELSE
set procedure to (lcRegProg) ADDITIVE
ENDIF
oReg=3DCreateObject("registry")

lcProgramFilesDir =3D ""

"SOFTWARE\Microsoft\Windows\CurrentVersion", HKEY_LOCAL_MACHINE)
IF llUseClass
RELEASE CLASSLIB (lcRegClass)
ELSE
RELEASE PROCEDURE (lcRegProg)
ENDIF

oReg =3D .NULL.
RETURN lcProgramFilesDir



> How can I find out the name and location of the Program Files folder =
from
> witin my VFP app?
>=20
> I've had a look at...
>=20
> Declare Integer SHGetSpecialFolderPath in Shell32.dll ;

>=20
> ...but can't seem to find a parameter that will return Program Files
> location.
>=20
> Thanks,
>=20
> Brian
>=20
>
 
 
Brian





PostPosted: Mon Jun 14 15:33:37 CDT 2004 Top

Exchange Servers >> "Program Files" location Thanks all.

Brian



Brian,
Eric is right - it's in the registry. I just tried this with VFP 9.0 beta on
XP and VFP 5.0 on Win98SE.
?progfilesdir()

Rick