Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

findwhether a particular user has logged into the n/w or not

Status
Not open for further replies.

nagalla

Programmer
Nov 18, 2001
4
0
0
IN
In visual Basic is there any way of finding -whether a particular user has logged into the network or not by using the fucntions of win32 api.
 
look up 'getusername' or 'WNetGet' in the MSDN
 
Neither GetUserName not WNetGetUserName (which I assume is the particular WNetGet function argusy meant) will help you at all as, to all intents and purposes, they merely return the name of the currently logged in user.

What you probably need to look at is NetUserGetInfo API call at level 2 (i.e returning USER_INFO_2 structures), and then check the usri2_last_logon and usri2_last_logoff members of the structure. If the last_logon is later than the last_logoff then that particular user is logged in. One warning: each BDC in an NT4 domain retains it's own info for each user, so you'll actually need to check EVERY domain controller to get the most recent last_login and the most recent last_logoff values.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top