代码如下:
Private Declare Function InternetGetConnectedState Lib "wininet.dll" (ByRef dwFlags As Long, ByVal dwReserved As Long) As Long
Private Sub Form_Load()
If InternetGetConnectedState(0&, 0&) Then
MsgBox "网络已连接"
Else
MsgBox "当前没有联网"
End If
End Sub
Private Sub Form_Load()
If InternetGetConnectedState(0&, 0&) Then
MsgBox "网络已连接"
Else
MsgBox "当前没有联网"
End If
End Sub