Hey, how do I know in vb when the comptuer connects to the internet, or check if it is already connected.
Printable View
Hey, how do I know in vb when the comptuer connects to the internet, or check if it is already connected.
Welcome to the forums. :wave:
VB what?
VB6?
VB.NET?
If VB6, Use this
Code: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()
'KPD-Team 2001
'URL: http://www.allapi.net/
'E-Mail: [email protected]
If InternetCheckConnection("http://www.allapi.net/", FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
MsgBox "Not connected ", vbInformation
Else
MsgBox "Connected", vbInformation
End If
End Sub
if your using VB2005, look at the My.Computer namespace, you should find what you need there