سلام
یک ماژول هستش که خودم استفاده می کنم ببین به دردت می خوره (فکر کنم قبلا از همین سایت برنامه نویس برداشتمش)
Module Detect
Public s_r, m_r, h_r As Int16
Public constr As String
'Dim form1 As New Form1
' function 4 check internet connection API
Public Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef lpSFlags As Int32, ByVal dwReserved As Int32) As Boolean
Enum InetConnState
modem = &H1
lan = &H2
proxy = &H4
ras = &H10
offline = &H20
configured = &H40
End Enum
#Region "Check Connection Type"
Function chk_internet() As String
Dim lngFlags As Long
If InternetGetConnectedState(lngFlags, 0) Then
' True
If lngFlags And InetConnState.lan Then
constr = "Connected With LAN"
ElseIf lngFlags And InetConnState.modem Then
constr = "Connected With DialUp"
ElseIf lngFlags And InetConnState.proxy Then
constr = "Useing Proxy Server"
ElseIf lngFlags And InetConnState.ras Then
constr = "Connected With RAS"
ElseIf lngFlags And InetConnState.offline Then
constr = " Is Offline."
End If
Else
' False
constr = "Off Line"
End If
Return (constr)
End Function
#End Region
#Region "Show Time Elapsed Of Connecting "
Function t_rm() As String
If s_r = 59 Then
m_r += 1 : s_r = 1
ElseIf m_r = 59 Then
m_r = 0 : h_r += 1
Else : s_r += 1
End If
Return (h_r & " : " & m_r & " : " & s_r).ToString
End Function
#End Region
End Module
موفق باشید