Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Sensing NT network connection

Posted on 1999-01-05
2
Medium Priority
?
164 Views
Last Modified: 2010-05-03
Is there a way in VB that I can test to determine whether or not the host system is currently logged onto a network?  (Specifically, NT).
0
Comment
Question by:harrrj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1454078
Take a look at this site. It contains kinds of code about  NT including what you want

http://www.netfokus.dk/vbadmincode/codevb.html
0
 
LVL 1

Accepted Solution

by:
NoCheese earned 400 total points
ID: 1454079
Keep in mind that an NT workstation is always logged onto a network, even when it is standalone, it is part of it's own local domain.

If you want to see if a user is logged on to the local machine or an external network such as a domain, is to compare the environment variable %COMPUTERNAME% against %USERDOMAIN%.  If they are the same, the user is logged in with a local account.  If they are different they are logged in to an external domain.

That is just half of the puzzle.  Once you have determined that the user is logged into an external domain, you need to find out if the user was actually validated, or logged in with cached credentials because they are currently disconnected.  Retreive the variable %LOGONSERVER%, append "\NETLOGON" to the end of it, and use that as the server path in the WNetGetUser API.  If the return value is NON "0", then the user is disconeccted.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question