vb最简洁的测试是否连接到网络的代码
3个回答
展开全部
引用WinSock控则神银孙宴件
Private Sub Command1_Click()
If Winsock1.State >瞎宴 0 Then Winsock1.Close
Winsock1.RemoteHost = "192.168.1.1"
Winsock1.RemotePort = 21
Winsock1.Connect
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Debug.Print Description
Description = ""
End Sub
Private Sub Command1_Click()
If Winsock1.State >瞎宴 0 Then Winsock1.Close
Winsock1.RemoteHost = "192.168.1.1"
Winsock1.RemotePort = 21
Winsock1.Connect
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
Debug.Print Description
Description = ""
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询