VB代码判断网络是否连接

| |
[不指定 2013/12/16 17:13 | by admin ]


Private Const FLAG_ICC_FORCE_CONNECTION = &H1
Private Declare  Function InternetCheckConnection Lib "wininet.dll" Alias  "InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As  Long, ByVal dwReserved As Long) As Long
'本代码使用Basic语言,转载请注明出处
Private Sub Command1_Click()
If InternetCheckConnection("http://www.hkfx.net", FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then
MsgBox "未连接", vbInformation
Else
MsgBox "已连接", vbInformation
End If
End Sub
程序源码 | 评论(0) | 引用(0) | 阅读(2039)