Search Tools Links Login

check internet connection


Visual Basic 6, or VB Classic

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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 118 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.