All pastes #826406 Raw Edit

Anonymous

public text v1 · immutable
#826406 ·published 2007-12-21 04:48 UTC
rendered paste body
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()
    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 = currentuser Then
        
        lpUserName = Left$(lpUserName, InStr(1, lpUserName, Chr$(0)) - 1)
    
    End
    Else
    End If
        If lResult = Andy Then
        
        lpUserName = Left$(lpUserName, InStr(1, lpUserName, Chr$(0)) - 1)
        
  
    End
    Else
    End If
End Sub