Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Determine A User's Full Name
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00577470
Message ID:
00577589
Views:
36
>Ok, I think I understand.
>
>Our domain name is "MCM_Domain"
>
>Knowing that, how would I code it with your example using
>my user name, 'kmarois':
>
>ouser = getobject('WinNT://MyDomain/MyPDCorBDC/Username,user')
>
>I got my user name from sys(0)

Luckily, I just happen to have a sample. < s >
clear
local lcpdc 
lcpdc = space(0)
declare integer NetGetDCName in netapi32 string, string, string@
lcserver = 0
lcdomain = 0
lcbuff = replicate(chr(0),255)
if NetGetDCName(lcserver, lcdomain, @lcbuff) = 0 then
   * fills lcbuff with a character representation of a pointer value
   * use the DWORDtoNum function in CLSHeap to translate it for the new
   * VFP 7 function SYS(2600)
   set procedure to clsheap

   * The name of the PDC is stored in the result using UNICODE
   * so we need to apply the necessary reverse functions via
   * STRCONV() to get single byte strings
   lcretval =  strconv(strconv(sys(2600,DWordtoNum(lcbuff),255),6),2)

   * The name of the PDC is NULL terminated so we need to truncate at the
   * first CHR(0) (now that we have eliminated the embedded CHR(0) for UNICODE)
   lcpdc = left(lcretval,at(chr(0),lcretval)-1)
endif

if !empty(lcpdc) then
	local louser, lcADSPath
	lcADSPath = 'WinNT://MCM_Domain/'+substr(lcpdc,3)+'/kmarois,user'
	louser = getobject(lcADSPath)
	
	? louser.FullName
endif
Good luck!
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform