03-22-2012، 10:30 AM
کد:
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
Sub CheckNetCon()
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
Private Sub Form_Load()
CheckNetCon
End Sub