Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: JLW Smith
  Where is JLW Smith?
 
 United Kingdom
 JLW Smith
 To: JLW Smith
  Where is JLW Smith?
 
 United Kingdom
 JLW Smith
 Tags
Subject: RE: NetworkConnection
Thread ID: 395395 Message ID: 395607 # Views: 39 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Network and Computer Management
Date: Thursday, January 16, 2014 10:23:56 AM         
   


In case anybody wants it, here is a solution in VB.Net;


Imports System.IO
Imports System.Text
Imports System
Imports System.Net
Imports System.Net.NetworkInformation
'Imports System.Runtime.InteropServices

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Visible = False
        NetworkingExample.Main()
    End Sub
End Class

Public Class NetworkingExample
    Public Shared Sub Main()
        AddHandler NetworkChange.NetworkAvailabilityChanged, AddressOf NetworkChangedCallback
        AccessStuff.WriteLog("Event loaded")

    End Sub 'Main
    Private Shared Sub NetworkChangedCallback(ByVal sender As Object, ByVal e As EventArgs)
        Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
        Dim n As NetworkInterface
        For Each n In adapters
            AccessStuff.WriteLog("Offline Status Event," & n.Name & "," & n.OperationalStatus.ToString & "," & n.NetworkInterfaceType)
        Next n
    End Sub
End Class

Public Class AccessStuff
    Public Shared Sub WriteLog(ByVal cData)
        Dim sb As StringBuilder = New StringBuilder()
        sb.AppendLine(cData)
        Using outfile As StreamWriter = New StreamWriter("SystemLog.txt", True)
            outfile.Write(sb.ToString())
        End Using
    End Sub
End Class


ENTIRE THREAD

NetworkConnection Posted by JLW Smith @ 1/14/2014 5:01:32 PM
RE: NetworkConnection Posted by David Mustakim @ 1/14/2014 5:31:56 PM
RE: NetworkConnection Posted by Pete Sass @ 1/14/2014 6:43:17 PM
RE: NetworkConnection Posted by JLW Smith @ 1/16/2014 10:23:56 AM