check internet connection
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
checks the internet connection
Original Author: Rakesh R. Shetty
Assumptions
I have tested this code on windows 2000 and XP.
Dont know whether it works for windows 9x.
Code
Private Const FLAG_ICC_FORCE_CONNECTION = 1
Private Declare Function InternetCheckConnection Lib "wininet.dll" Alias "InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Boolean
Private Sub Command1_Click()
Dim abc As String
abc = InternetCheckConnection("http://www.microsoft.com", FLAG_ICC_FORCE_CONNECTION, 0)
If abc = "True" Then
MsgBox "Connected to the internet."
Else
MsgBox "Not connected to the internet."
End If
End Sub
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.