Local Settings\Application Data directory

Local Settings\Application Data directory

Postby Marc Vanzegbroeck » Mon Jun 25, 2007 5:41 pm

Hello,

How can I retrieve the %USERPROFILE%\Local Settings\Application Data directory?

Thanks,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby dutch » Wed Jun 27, 2007 3:43 am

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"
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Marc Vanzegbroeck » Wed Jun 27, 2007 5:11 am

Thanks Dutch,

Its's working!!

Regards,
Marc
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Postby dutch » Wed Jun 27, 2007 6:59 pm

Cheer!
My pleasure,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 8 guests