
API call to get Netware user name from 32-bit client using MSFT Client for Netware
You can try this old code I had - I think it worked, I had it commented out.
Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal
lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long
Function GetNetUserName() As String
Dim sName As String
Dim sUserName As String
Dim lLen As Long
Dim iRet As Long
GetNetUserName = ""
sName = "M:"
sUserName = Space(256)
lLen = 256
iRet = WNetGetUser(sName, sUserName, lLen)
' For netware 4.x, this returns a string like "CN=ShawkeyM"
lLen = InStr(1, sUserName, "CN=")
If lLen > 0 Then
sUserName = UCase$(Trim$(Mid$(sUserName, lLen + 3)))
lLen = Len(sUserName)
sUserName = Left$(sUserName, lLen - 1)
Else
sUserName = ""
End If
GetNetUserName = sUserName
'GetNetUserName = UCase$(Environ("NAME"))
End Function
Stephen Hudnall wrote in article
Quote:
>I am not having much luck locating a API call to get the Netware user name
>from a 32-bit client using the Microsoft Client for Netware. All the
>packages I have seen require using Netware Client 32; which is to {*filter*} for
>me.......
>Sure would appreciate any help........
>Thanks,
>Steve