Hai,
I am developing an application for a Windows NT network. Now I would like to know the users logged in different workstations in the network. Is there a way to get around this?
Thanks in advance.
Kishore.
Printable View
Hai,
I am developing an application for a Windows NT network. Now I would like to know the users logged in different workstations in the network. Is there a way to get around this?
Thanks in advance.
Kishore.
'Informations here come from Api-Guide, a free tool you can download at:
'http://www.allapi.net/
'
'The GetUserName function retrieves the user name of the current thread.
'This is the name of the user currently logged onto the system.
'Example
'This project needs a timer
private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (byval lpBuffer as string, nSize as Long) as Long
private Declare Function GetTempPath Lib "kernel32" Alias "GetTempPathA" (byval nBufferLength as Long, byval lpBuffer as string) as Long
private Declare Function IsIconic Lib "user32" (byval hwnd as Long) as Long
private Sub Form_Load()
'KPD-Team 1998
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Timer1.Interval = 100
Timer1.Enabled = true
Dim strTemp as string, strUserName as string
'Create a buffer
strTemp = string(100, Chr$(0))
'get the temporary path
GetTempPath 100, strTemp
'strip the rest of the buffer
strTemp = Left$(strTemp, InStr(strTemp, Chr$(0)) - 1)
'Create a buffer
strUserName = string(100, Chr$(0))
'get the username
GetUserName strUserName, 100
'strip the rest of the buffer
strUserName = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)
'Show the temppath and the username
MsgBox "Hello " + strUserName + Chr$(13) + "The temp. path is " + strTemp
End Sub
private Sub Timer1_Timer()
Dim Boo as Boolean
'Check if this form is minimized
Boo = IsIconic(me.hwnd)
'Update the form's caption
me.Caption = "Form minimized: " + Str$(Boo)
End Sub
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
Dear Rater,
Thank you for your reply. The code worked well for my local system. But what about other workstations in the network? It is important for me. Any reply will be very much appreciated.
Thank you once again.
Kishore.