VB Sample Script to get current Windows User's Name:

Mindwatering Incorporated

Author: Tripp W Black

Created: 06/01/2005 at 05:18 PM

 

Category:
General Web Tips
Other

Sample Script to get current Windows User's Name:

(Source: This might be from notes.net somewhere.)

Includes:
'-------------------------------------
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (Byval
lpBuffer As String, nSize As Long) As Long
'-------------------------------------



'-------------------------------------
Dim lpBuff As String * 25
Dim ret As Long

ret = GetUserName(lpBuff, 25)
UserName = Ucase(Left(lpBuff, Instr(lpBuff, Chr(0)) - 1))


Msgbox "User name: " + UserName
'-------------------------------------

previous page