0

I'm using Windows XP and I want to know if the local area is available or not?

And if I'm using another OS would that affect on my code?

BDeveloper
  • 1,125
  • 5
  • 22
  • 43
  • Which language are you using? Do you need win32 API calls or managed libraries? – OJ. Dec 13 '08 at 09:08

3 Answers3

0

Use the following code

using System.Net.NetworkInformation; //(Add reference of System.Net.dll)
public partial class Form1: Form
{
    public Form1()
    {
        InitializeComponent();
        NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
    }
    private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
    {
        if(e.IsAvailable)
        {
            //connected
        }
        else
        {
            //disconnected
        }
    }
}
NASSER
  • 5,730
  • 7
  • 37
  • 56
-1

The source code for ToggleNic shows you how to enable, disable or check for available network connections on windows. This is in C#.

kit
  • 1,150
  • 5
  • 15
  • 22
Agnel Kurian
  • 56,037
  • 41
  • 141
  • 214
-1

Here's how to do it in Delphi.

Community
  • 1
  • 1
Mick
  • 13,018
  • 9
  • 64
  • 118