Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General 2 / May 2005



Tip: Looking for answers? Try searching our database.

InternetGetConnectedState

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Greg Siemon - 26 Apr 2005 03:23 GMT
I' am using InternetGetConnectedState to determine if I' am connected to the
internet.  All works well except when the connection is a wireless
connection.  The connection is fine and I can access the internet but
InternetGetConnectedState returns false.  I must be missing something.

Thanks in advance of any help.
MikeD - 26 Apr 2005 03:49 GMT
> I' am using InternetGetConnectedState to determine if I' am connected to the
> internet.  All works well except when the connection is a wireless
> connection.  The connection is fine and I can access the internet but
> InternetGetConnectedState returns false.  I must be missing something.

The only reliable way to determine if you've got an internet connection is
to actually try and connect to something. InternetGetConnectedState (and any
other means other than actually connecting) are not 100% reliable.

Signature

Mike
Microsoft MVP Visual Basic

M. Posseth - 01 May 2005 09:47 GMT
This should work in all situations , on my systems it does ( DIALUP , DSL ,
WIFI )

Private Const FLAG_ICC_FORCE_CONNECTION = &H1
Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias
"InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long,
ByVal dwReserved As Long) As Long
Private Sub Form_Load()

   If InternetCheckConnection("http://www.google.com/",
FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
       MsgBox "Connection tohttp://www.google.com/ failed!", vbInformation
   Else
       MsgBox "Connection to http://www.google.com/ succeeded!",
vbInformation
   End If
End Sub

ofcourse this will only fail if the reference site is down

happy coding  :-)

M. Posseth   [MCP]

> I' am using InternetGetConnectedState to determine if I' am connected to the
> internet.  All works well except when the connection is a wireless
> connection.  The connection is fine and I can access the internet but
> InternetGetConnectedState returns false.  I must be missing something.
>
> Thanks in advance of any help.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.