-
I need to get the users name from Novell. I have downloaded the NWSess.OCX. However, I am not familiar with it but it doesn't seem to work. I don't want the user to sign in a second time to my application. I simply want to get the username that is already signed in to Novell prior to the user opening my app.
Thanks
-
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.
Code:
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
Hope this can help
(Using VB 6 SP 3)
-
This will get me the userID in our environment. However, I need the user name which is stored on Novell.
Thanks for the reply.