Make your own free website on Tripod.com

AllApi.net

[an error occurred while processing this directive]
 
Private Declare Function w32_WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpszLocalName As String, ByVal lpszUserName As String, lpcchBuffer As Long) As Long
Private Sub Form_Load()
    'KPD-Team 1998
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Allapi.net
    Dim lpUserName As String, lpnLength As Long, lResult As Long
    'Create a buffer
    lpUserName = String(256, Chr$(0))
    'Get the network user
    lResult = w32_WNetGetUser(vbNullString, lpUserName, 256)
    If lResult = 0 Then
        lpUserName = Left$(lpUserName, InStr(1, lpUserName, Chr$(0)) - 1)
        MsgBox "The user's Network Logon Name is " + lpUserName + ".", vbInformation + vbOKOnly, App.Title
    Else
        MsgBox "No user found !", vbExclamation + vbOKOnly, App.Title
    End If
End Sub


 
Copyright © 1998-2000, The KPD-Team.
Send mail to KPDTeam@Allapi.net with comments about this web site.
This site is located at
http://www.Allapi.net/