? ... Getting Novell Username from VB3 
Author Message
 ? ... Getting Novell Username from VB3

Anyone know how to get a users Novell username
when a logged in user executes a VB3 program??

Dave Crabbe

+----------------------------
Dave Crabbe
NSCC Burridge Campus
Yarmouth, Nova Scotia, Canada



Sun, 19 Jul 1998 03:00:00 GMT  
 ? ... Getting Novell Username from VB3

Quote:

>Anyone know how to get a users Novell username
>when a logged in user executes a VB3 program??

Take a look at the built in VB 'Environ' function.

Univ of Missouri-Columbia
Programmer/Analyst


Tue, 21 Jul 1998 03:00:00 GMT  
 ? ... Getting Novell Username from VB3

Quote:
>>Anyone know how to get a users Novell username when a logged in user executes a VB3 program??
>Take a look at the built in VB 'Environ' function.


*NO*, but thanks for playing our game...we have some lovely parting
gifts....

The VB Environ/Environ$ function will return a DOS environmental
variable- you cannot assume that the Novell Administrator set up a
variable called NOVELL_USER_NAME. Even if the administrator had set up
such a variable, nothing keeps the user from then changing it from
DOS.

There's an API call I do not remember -- In (???) NWCALLS.DLL (???)
that will return the Novell User ID. From what I recall, *that* call
works for Netware 3.x, not 4.x.



Tue, 21 Jul 1998 03:00:00 GMT  
 ? ... Getting Novell Username from VB3

Quote:
>There's an API call I do not remember -- In (???) NWCALLS.DLL (???)
>that will return the Novell User ID. From what I recall, *that* call
>works for Netware 3.x, not 4.x.

Where would one track down this info??

Dave

+----------------------------
Dave Crabbe
NSCC Burridge Campus
Yarmouth, Nova Scotia, Canada



Wed, 22 Jul 1998 03:00:00 GMT  
 ? ... Getting Novell Username from VB3

Quote:
>Anyone know how to get a users Novell username
>when a logged in user executes a VB3 program??

yes, you can use the next call and procedure:

'put this in youre module section on one (1) line
Declare Function wu_WNetGetUser% Lib "USER.EXE" Alias "WNetGetUser" (ByVal
szUser$, lpnBufferSize%)

'put this on the StartForm
Sub check_user ()
    Dim loginname

On Error GoTo fout_user

    'username opvragen
    loginname = NetworkUserID()

    If loginname = "" Then
        MsgBox "You must logon to a Novell network..."
        Unload StartForm
    End If

    'programma starten
    Exit Sub

fout_user:
        msgbox cstr(err)
        Unload StartForm
End Sub

'same for this function
Function NetworkUserID () As String
    Dim szUser As String * 255
    Dim lpnBufferSize%
    Dim status%

    lpnBufferSize = 255
    status = wu_WNetGetUser(szUser, lpnBufferSize)
    If status = 3 Then
        NetworkUserID = "Error"
        Unload StartForm
    Else
        NetworkUserID = Left$(szUser, InStr(szUser, Chr(0)) - 1)
    End If
End Function

So when you want to know the username you use the command 'check_user'. If you
make the variable LoginName (in the proc check_user) global you can use the
variable in all the other procedures.

good luck
gr. walther

n.b. it works with w3.x but also with w95.



Sun, 26 Jul 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Getting Username in Novell via Visual Basic

2. Problem getting Novell username from WfW 3.11

3. Retrieving Novell Username

4. ??#Retrieving Username from Novell Network (Windows95/NT)

5. VB4 finding current Novell 4.1 username

6. Novell Logon UserName in vb4 16bit

7. Novell Username

8. Username in Novell Network

9. Novell Username

10. Novell Usernames

11. Novell username variable

12. Novell Client Username

 

 
Powered by phpBB® Forum Software