Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
_
(ByVal lpBuffer As String, nSize As Long) As Long
Dim lngCount As Integer
Dim lngRetCod As Long
Dim strUsername As String
Dim strLoginName As String * 64
Dim strNull As String
'
' Get the login name to use in fetching preferences
'
lngRetCod = GetUserName(strLoginName, 64) ' Get the windows login
name
strNull = Chr$(0)
lngCount = InStr(strLoginName, strNull)
If (lngCount = 1) Then
' No user name available
strUsername = "User"
ElseIf (lngCount > 0) Then
strUsername = Left$(strLoginName, lngCount - 1)
Else
strUsername = strLoginName
End If
> In an application, I need to obtain the NT login id that
> is currently logged on.
[quoted text clipped - 3 lines]
> Thanks,
> Acie