Internet
-
hi.. could u pls help in getting the code for checking whether an internet connection was setup or not in vb?
Try something like this, there are actually several ways to check for something like this, but they all differ slightly.
Private Const INTERNET_CONNECTION_CONFIGURED = &H40
Private Const INTERNET_CONNECTION_LAN = &H2
Private Const INTERNET_CONNECTION_MODEM = &H1
Private Const INTERNET_CONNECTION_OFFLINE = &H20
Private Const INTERNET_CONNECTION_PROXY = &H4
Private Const INTERNET_RAS_INSTALLED = &H10
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long
Private Sub Form_Load()
Dim Ret As Long
Me.AutoRedraw = True'retrieve the connection status InternetGetConnectedState Ret, 0& 'show the result If (Ret And INTERNET\_CONNECTION\_CONFIGURED) = INTERNET\_CONNECTION\_CONFIGURED Then Me.Print "Local system has a valid connection to the Internet, but it may or may not be currently connected." If (Ret And INTERNET\_CONNECTION\_LAN) = INTERNET\_CONNECTION\_LAN Then Me.Print "Local system uses a local area network to connect to the Internet." If (Ret And INTERNET\_CONNECTION\_MODEM) = INTERNET\_CONNECTION\_MODEM Then Me.Print "Local system uses a modem to connect to the Internet." If (Ret And INTERNET\_CONNECTION\_OFFLINE) = INTERNET\_CONNECTION\_OFFLINE Then Me.Print "Local system is in offline mode." If (Ret And INTERNET\_CONNECTION\_PROXY) = INTERNET\_CONNECTION\_PROXY Then Me.Print "Local system uses a proxy server to connect to the Internet." If (Ret And INTERNET\_RAS\_INSTALLED) = INTERNET\_RAS\_INSTALLED Then Me.Print "Local system has RAS installed."
End Sub
Nick Parker
**The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
**