View Full Version: Detect Internet

Cservers > Visual Basic > Detect Internet


Title: Detect Internet


|2eM!x - March 27, 2005 08:34 PM (GMT)
CODE

Option Explicit
Private Const INTERNET_CONNECTION_CONFIGURED = &H40
Private Const INTERNET_CONNECTION_LAN = &H2
Private Const INTERNET_CONNECTION_MODEM = &H1
Private Const INTERNET_CONNECTION_OFFLINE = &H20
Private Const INTERNET_CONNECTION_PROXY = &H4
Private Const INTERNET_RAS_INSTALLED = &H10

Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal dwReserved As Long) As Long

Private Sub Form_Load()
MsgBox IsOnline
End Sub

Public Function IsOnline() As Boolean
Dim lngRet  As Long
   InternetGetConnectedState lngRet, 0&
   If (lngRet And INTERNET_CONNECTION_CONFIGURED) = INTERNET_CONNECTION_CONFIGURED Then
       If (lngRet And INTERNET_CONNECTION_OFFLINE) <> INTERNET_CONNECTION_OFFLINE Then
           IsOnline = True
       End If
   End If
End Function

MaikuČ - March 30, 2005 06:44 AM (GMT)
Hmmm..how do i use it?

|2eM!x - March 30, 2005 06:48 AM (GMT)
lol man..ill explain on msn

EngulF - April 14, 2005 09:17 PM (GMT)
wtf...well its dusnt explain anything if you jus type "detect internet" dus it

|2eM!x - April 14, 2005 09:49 PM (GMT)
what??

this tells you if your connected to the internet. if you arent then you can do something in your program, and if it is you can do something else...




* Hosted for free by InvisionFree