'请把代码 PingCode.bas 添加到你的程序模块中,然后在你的程序中加入以下代码即可:
Private Sub Command1_Click()
Dim iReply As Long, sAddress As String
sAddress = "192.168.1.1"
iReply = Ping(sAddress)
If iReply > 0 Then
'Ping通后的代码
Else
'Ping不通后的代码
End If
End Sub
这个很简单呀!