3 replies
by dklippert
Here's some code that has been floating around in the forums:
(I've put a blank line between each line of code to help indicate line wrap)
Option Compare Database
Option Explicit
'***** Code Start **************************
Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
EndIf
End Function
'*********** Code End **************************
by miss kitty
by miss kitty
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending