That should tell you if you are connected to a network. It will also tell you which type.
VB Code:
Const NETWORK_ALIVE_AOL = &H4 Const NETWORK_ALIVE_LAN = &H1 Const NETWORK_ALIVE_WAN = &H2 Private Declare Function IsNetworkAlive Lib "SENSAPI.DLL" (ByRef lpdwFlags As Long) As Long Private Sub Form_Load() Dim Ret As Long If IsNetworkAlive(Ret) = 0 Then MsgBox "The local system is not connected to a network!" Else MsgBox "The local system is connected to a " + IIf(Ret = NETWORK_ALIVE_AOL, "AOL", IIf(Ret = NETWORK_ALIVE_LAN, "LAN", "WAN")) + " network!" End If End Sub




Reply With Quote