Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Win API that returns User folder path?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00814598
Message ID:
00814627
Vues:
15
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform