Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get the full user's name of the PC
Message
From
15/06/2009 17:19:06
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01406221
Message ID:
01406223
Views:
136
This message has been marked as a message which has helped to the initial question of the thread.
>Hi everybody,
>
>How can I get my full user's name instead of what ID() function returns?
>
>Thanks in advance.

do you mean the NT username?

(it's also here:)
http://support.microsoft.com/kb/139625
*--George: dbfForums 2007
*---+ Get Windows NT Username
private lcUserIDBuffer, lnBufferSize, RetVal

RetVal         = 0
lcUserIDBuffer = Space(25) && Return buffer for user ID string
lnBufferSize   = 25        && Size of user ID return buffer

Declare Integer GetUserName In Win32API As GetName;
        String  @lcUserIDBuffer,;
        Integer @lnBufferSize

RetVal = GetName(@lcUserIDBuffer, @lnBufferSize)

lcNTUsername = Left(lcUserIDBuffer, lnBufferSize-1)

If empty(lcNTUsername)
	lcNTUsername = "Unknown"
ENDIF
?lcNTUsername
*---+ Username retrieved.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform