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:
00814627
Views:
14
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform