|
-
Jan 28th, 2006, 05:09 PM
#1
Thread Starter
PowerPoster
InternetGetConnectedState Wrong. Why?
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
-
Jan 28th, 2006, 05:21 PM
#2
Re: InternetGetConnectedState Wrong. Why?
It might be better to PING a site that is usually up, and trap the code, to tell if it's online. Your API determines the state. It will let you know if an Internet connection has been set up, not if it's online.
-
Jan 28th, 2006, 05:26 PM
#3
Thread Starter
PowerPoster
Re: InternetGetConnectedState Wrong. Why?
-
Jan 29th, 2006, 08:57 AM
#4
Re: InternetGetConnectedState Wrong. Why?
if you use a router like a DSL modem then it will always say you are online for some reason.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|