Detecting if connected to LAN or WAN
One line of code will tell you if you are connected to LAN or WAN(Internet).
Rate Detecting if connected to LAN or WAN
(5(5 Vote))
Private Declare Function IsNetworkAlive Lib "Sensapi.dll" (LPDFlags As Long) As Long
Private Const NETWORK_ALIVE_LAN = &H1 'net card connection
Private Const NETWORK_ALIVE_WAN = &H2 'RAS connection
Private Const NETWORK_ALIVE_AOL = &H4 'AOL
Private Sub Form_Load()
Dim tmp As Long
Dim ConnectionType As String
If IsNetworkAlive(tmp) = NETWORK_ALIVE_LAN Then
ConnectionType = "LAN"
ElseIf IsNetworkAlive(tmp) = NETWORK_ALIVE_WAN Then
ConnectionType = "WAN"
ElseIf IsNetworkAlive(tmp) = NETWORK_ALIVE_AOL Then
ConnectionType = "AOL"
Else
ConnectionType = "Could not Determine."
End If
Print
Print "Your connection type is: " & ConnectionType
End Sub
Detecting if connected to LAN or WAN Comments
No comments yet — be the first to post one!
Post a Comment