Link to home
Start Free TrialLog in
Avatar of rbend
rbendFlag for United States of America

asked on

How to get the Novel Netware username from a PC

I need to know how to determin the Novel Netware Username on a PC where my app is running.
I know how to get it from the Registry using 95,98 and 2000 but Novel doesn't work the same (DLL problems).
(example code please)
??
Avatar of cquinn
cquinn
Flag of United Kingdom of Great Britain and Northern Ireland image

Try this function using the API - the Declare statement is a single line:


Declare Function WNetGetUser Lib "mpr" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpusername
As String, lpnLength As Long) As Long

Function GetUser() As String
Dim ReturnCode As Integer
Dim UserName As String
Dim lp As String
   Dim size As Long
   GetUser = "Nonetwrk"
   UserName = String$(255, 0)
   size = Len(UserName)
   ReturnCode = WNetGetUser&(lp, UserName, size)
   If ReturnCode = 0 Then
       While Asc(Mid$(UserName, size, 1)) = 0
           size = size - 1
       Wend
       GetUser = left$(UserName, size)
   End If
End Function
Avatar of rbend

ASKER

I think this just gives me the Windows Login Username.
I need the Novel Netware username.
Avatar of Anthony Perkins
Please maintain your open questions and you will find experts more receptive:

http://devx.experts-exchange.com/jsp/memberProfile.jsp?mbr=rbend&showQHistory=true

Questions Asked 80
Last 10 Grades Given A A A B A A B B B B  
Question Grading Record 72 Answers Graded / 73 Answers Received

Thanks,
Anthony
Avatar of rbend

ASKER

never answered adequately
ASKER CERTIFIED SOLUTION
Avatar of msc0tt
msc0tt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of twalgrave
twalgrave

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to msc0tt
Please leave any comments here within the
next seven days.
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange