#2
yiyanxiyin2024-04-24 13:35
|
程序代码:
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Command1.Visible = False
End Sub
Private Sub Timer1_Timer()
Winsock1.Close '不管状态,先关闭当前连接
DoEvents '确保关闭操作完成
Winsock1.Connect "183.2.172.185", 80 '连接百度服务器
End Sub
Private Sub Timer2_Timer()
Command1_Click
End Sub
Private Sub Command1_Click()
If Winsock1.State = sckConnected Then
Label1.Caption = "网络正常"
Else
Label1.Caption = "网络异常"
End If
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Command1.Visible = False
End Sub
Private Sub Timer1_Timer()
Winsock1.Close '不管状态,先关闭当前连接
DoEvents '确保关闭操作完成
Winsock1.Connect "183.2.172.185", 80 '连接百度服务器
End Sub
Private Sub Timer2_Timer()
Command1_Click
End Sub
Private Sub Command1_Click()
If Winsock1.State = sckConnected Then
Label1.Caption = "网络正常"
Else
Label1.Caption = "网络异常"
End If
End Sub
只有本站会员才能查看附件,请 登录