Local Settings\Application Data directory
Posted:
Mon Jun 25, 2007 5:41 pm
by Marc Vanzegbroeck
Hello,
How can I retrieve the %USERPROFILE%\Local Settings\Application Data directory?
Thanks,
Marc
Posted:
Wed Jun 27, 2007 3:43 am
by dutch
Dear Marc,
You can use GetEnv() as in Clipper function.
- Code: Select all Expand view
GETENV("USERPROFILE")
*------------------------*
Function GetEnv(VarString)
Local OutBuf:=space(200),VarLen:=0
VarLen:=GetEnv2(ALLTRIM(VarString),Outbuf,200)
* If the value return is greater than the initial buffer we have to increase
* it to receive the value but I limit the length to 3000
if VarLen > 200 .and. VarLen <=3000
Outbuf:=SPACE(VarLen)
GetEnv2(ALLTRIM(VarString),Outbuf,Varlen)
elseif VarLen > 3000
MSGINFO("Can't retrieve, the value is too long")
VarLen:=0
endif
Return Left(OutBuf,Varlen)
DLL32 FUNCTION GetEnv2( lpName AS LPSTR, lpBuffer AS LPSTR, nSize AS DWORD) ;
AS DWORD PASCAL FROM "GetEnvironmentVariableA" LIB "Kernel32.DLL"
Posted:
Wed Jun 27, 2007 5:11 am
by Marc Vanzegbroeck
Thanks Dutch,
Its's working!!
Regards,
Marc