Parsi Coders
سورس کد بررسی وضعیت اتصال به اینترنت - نسخه قابل چاپ

+- Parsi Coders (http://parsicoders.com)
+-- انجمن: Software Development Programming (http://parsicoders.com/forumdisplay.php?fid=37)
+--- انجمن: Visual Basic Programming (http://parsicoders.com/forumdisplay.php?fid=39)
+---- انجمن: Visual Basic 6 (http://parsicoders.com/forumdisplay.php?fid=44)
+---- موضوع: سورس کد بررسی وضعیت اتصال به اینترنت (/showthread.php?tid=1943)



سورس کد بررسی وضعیت اتصال به اینترنت - Amin_Mansouri - 03-22-2012

کد:
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