I am using this code and it tells me that I am online even when my Comcast modem is offline. Why?
Code:Public Declare Function InternetGetConnectedState _ Lib "wininet.dll" (ByRef lpdwFlags As Long, _ ByVal dwReserved As Long) As Long 'Local system uses a modem to connect to ' the Internet. Public Const INTERNET_CONNECTION_MODEM As Long = &H1 'Local system uses a LAN to connect to t ' he Internet. Public Const INTERNET_CONNECTION_LAN As Long = &H2 'Local system uses a proxy server to con ' nect to the Internet. Public Const INTERNET_CONNECTION_PROXY As Long = &H4 'No longer used. Public Const INTERNET_CONNECTION_MODEM_BUSY As Long = &H8 Public Const INTERNET_RAS_INSTALLED As Long = &H10 Public Const INTERNET_CONNECTION_OFFLINE As Long = &H20 Public Const INTERNET_CONNECTION_CONFIGURED As Long = &H40 'InternetGetConnectedState wrapper functions Public Function IsNetConnectOnline() As Boolean On Error GoTo err 'no flags needed here - the API returns ' True 'if there is a connection of any type IsNetConnectOnline = InternetGetConnectedState(0&, 0&) Exit Function err: err.Raise vbObjectError + 773, , "IsNetConnectOnline" End Function




Reply With Quote