how to get the full user name?

user1327073 picture user1327073 · Jan 29, 2013 · Viewed 14.8k times · Source

I have the following code in VBS that works perfectly. it queries AD to get the user full name :

Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strFullName = objUser.Get("displayName")
MsgBox strFullName

i would like to do the same thin but in Foxpro 7. anybody has experience with VFP 7 or 9 ?

Answer

DRapp picture DRapp · Jan 30, 2013

sys(0) returns both machine name and user something like

lcMachineUser = sys(0)
lcMachine = LEFT( lcMachineUser, AT( "#", lcMachineUser) -1 )
lcUserName = substr( lcMachineUser, AT( "#", lcMachineUser) +1 )