Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to see if internet is connected?

Status
Not open for further replies.

Toastie

Programmer
May 19, 2001
123
AU
I have used the following api but dosent seem to work
Its result dosent change if i am connected to the net or not

the key thing is that i dont wish to connect to the internet if it is not connected and i dont wish to use any net rescources i just want to see if the modem is connected


Private Declare Function InetIsOffline Lib "url.dll" (ByVal dwFlags As Long) As Long
Private Sub Form_Load()
'KPD-Team 2001
'URL: 'E-Mail: KPDTeam@Allapi.net
'InetIsOffline returns 0 if you're connected
MsgBox "Are you connected to the internet? " + CStr(CBool(InetIsOffline(0))), vbInformation
End Sub
 
found it

'Example by Vijay Phulwadhawa (vijaycg44@hotmail.com)
Private Declare Function InternetGetConnectedStateEx Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal lpszConnectionName As String, ByVal dwNameLen As Integer, ByVal dwReserved As Long) As Long
Dim sConnType As String * 255
Private Sub Form_Load()
Dim Ret As Long
Ret = InternetGetConnectedStateEx(Ret, sConnType, 254, 0)
If Ret = 1 Then
MsgBox "You are connected to Internet via a " & sConnType, vbInformation
Else
MsgBox "You are not connected to internet", vbInformation
End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top