PDA

Click to See Complete Forum and Search --> : get users logged


minnal
Nov 10th, 1999, 01:22 PM
hi,
Wheather it is possible to get the users logged in winnt environment?
thanks in advance
minnal

SteveS
Nov 10th, 1999, 01:51 PM
No Problem.
Create a new standard project
Place 1 Command button on the form
Paste in the following code, into the forms code section.

Private Declare Function WNetGetUserA Lib "mpr" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long

Private Function GetUserName() As String
Dim sUserNameBuff As String * 255
sUserNameBuff = Space(255)
Call WNetGetUserA(vbNullString, sUserNameBuff, 255&)
GetUserName = Left$(sUserNameBuff, InStr(sUserNameBuff, vbNullChar) - 1)
End Function

Private Sub Command1_Click()
Me.Caption = GetUserName
End Sub

Hope this helps,

Steve.

minnal
Nov 10th, 1999, 03:14 PM
Hi Steve
Thankx for ur immediate response its working perfect.

But is there any API for getting all the users logged in the network .

i need to add all the users logged in the nT network into a combo or list box.

please reply

bye

Minnal

minnal
Nov 10th, 1999, 03:55 PM
Hi Steve
Thankx for ur immediate response its working perfect.

But is there any API for getting all the users logged in the network .

i need to add all the users logged in the nT network into a combo or list box.

please reply

bye

Minnal