I don't think that this technically returns the Novell user name, but it does return the username of the user that the network connection was established under. So in my office, the two are always the same, so it seems to have the same effect.
Hope this can helpCode:Private Declare Function WNetGetUser Lib "mpr.dll" _ Alias "WNetGetUserA" (ByVal lpName As String, _ ByVal lpUserName As String, lpnLength As Long) As Long Const NoError = 0 Sub GetUserName() Const lpnLength As Integer = 255 Dim status As Integer Dim lpName, lpUserName As String lpUserName = Space$(lpnLength + 1) status = WNetGetUser(lpName, lpUserName, lpnLength) If status = NoError Then lpUserName = Left$(lpUserName, InStr(lpUserName, Chr(0)) - 1) Else MsgBox "Unable to get the name." End End If MsgBox "Logged Username: " & lpUserName End Sub Private Sub Command1_Click() GetUserName End Sub
(Using VB 6 SP 3)




Reply With Quote