Problem checking for internet connection

  • Thread starter Thread starter Flashster
  • Start date Start date
F

Flashster

This check seems to be 'true' even when I'm not connected to the internet.
My network card is disabled also. Could someone tell me what I'm doing
wrong?

--
Declare Function InternetCheckConnection Lib "wininet.dll" Alias
"InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long,
ByVal dwReserved As Long) As Long



Private Sub btn_chk_int_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_chk_int.Click

Const FLAG_ICC_FORCE_CONNECTION = False

If InternetCheckConnection("http://www.yahoo.com",
FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then

MsgBox("Connection to http://www.yahoo.com ---failed---!",
vbInformation)

Else

MsgBox("Connection to http://www.yahoo.com succeeded!",
vbInformation)

End If

End Sub



--
 
Flashster said:
This check seems to be 'true' even when I'm not connected to the internet.
My network card is disabled also. Could someone tell me what I'm doing
wrong?

Your declaration is wrong. Use this one instead:

\\\
Private Declare Auto Function InternetCheckConnection Lib "wininet.dll" ( _
ByVal lpszUrl As String, _
ByVal dwFlags As Int32, _
ByVal dwReserved As Int32 _
) As Boolean

Private Const FLAG_ICC_FORCE_CONNECTION As Int32 = &H1
///
 
Thanks


Herfried K. Wagner said:
Your declaration is wrong. Use this one instead:

\\\
Private Declare Auto Function InternetCheckConnection Lib "wininet.dll"
( _
ByVal lpszUrl As String, _
ByVal dwFlags As Int32, _
ByVal dwReserved As Int32 _
) As Boolean

Private Const FLAG_ICC_FORCE_CONNECTION As Int32 = &H1
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top