Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Win API that returns User folder path?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00814598
Message ID:
00815316
Views:
10
Anatoliy,
This looks very useful indeed. Although I have already implemented the GETENV("TEMP") that Tom suggested, I will keep this for future consideration.

Thanks,
Mark

And thanks to George Tasker for his reply for returning the username.

>
>DECLARE INTEGER ExpandEnvironmentStrings IN kernel32;
>	STRING  lpSrc, STRING @lpDst, INTEGER nSize
>
>? "COMPSPEC=",     GetVar ("%comspec%")
>? "COMPUTERNAME=", GetVar ("%computername%")
>? "USERDOMAIN=",   GetVar ("%userdomain%")
>? "USERNAME=",     GetVar ("%username%")
>? "USERPROFILE=",  GetVar ("%userprofile%")
>? "SYSTEMROOT=",   GetVar ("%systemroot%")
>? "TEMP=",         GetVar ("%temp%")
>? "TMP=",          GetVar ("%tmp%")
>? "PATH=",         GetVar ("%path%")
>
>FUNCTION GetVar(lcVarname)
>	LOCAL lnBufferSize, lcResult
>	lnBufferSize = 2048
>	lcResult = SPACE(lnBufferSize)
>	lnResult = ExpandEnvironmentStrings(lcVarname, @lcResult, lnBufferSize)
>RETURN IIF(lnResult > 0, LEFT(lcResult, AT(Chr(0), lcResult)-1), '')
>
>
>Original link:
>http://www.news2news.com/vfp/?example=132&function=195
Mark Rietman
Previous
Reply
Map
View

Click here to load this message in the networking platform