Hello,
Could anyone tell me how to get the current user that is running on NT?
Thanks.
Marco
Printable View
Hello,
Could anyone tell me how to get the current user that is running on NT?
Thanks.
Marco
In VB it tis something like this...
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal _
lpbuffer As String, nsize As Long) As Long
Sub Get_User_Name()
Dim lpBuff As String * 25
Dim ret As Long
Dim UserName As String
ret = GetUserName(lpBuff, 25)
UserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
'MsgBox UserName
UserName1 = UserName
End Sub
Hope it Helped
Thanks Raicheman, it worked like a dream, but can I use this function in Windows 95/98/2000 too?