Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NT User Name

Status
Not open for further replies.

kioko

Programmer
Joined
Sep 29, 2000
Messages
9
Location
US
Is it possible if you to retrieve the user name of the person who is logged on to a machine /domain in win9x /nt from withing vb and or msaccess if you are not using MS SQL
i know it is possible using SQL but the application i have written uses an Access Database

Please help

Kioko
 
Use this API function:
Code:
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Sub Main()
    Dim ret As Long
    Dim sUserName As String
    Dim lpBuff As String * 25

    'Get the Login Name
    ret = GetUserName(lpBuff, 25)
    sUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
    sUserName = UCase(sUserName)

    MsgBox sUserName
End Sub

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top