📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "网络目标的可达性"
ClientHeight = 2595
ClientLeft = 45
ClientTop = 330
ClientWidth = 5475
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2595
ScaleWidth = 5475
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "运行(&R)"
Height = 375
Left = 3960
TabIndex = 7
Top = 2040
Width = 1215
End
Begin VB.TextBox Text1
Height = 270
Index = 0
Left = 1680
TabIndex = 6
Text = "Text1"
Top = 600
Width = 1935
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1680
TabIndex = 5
Text = "Combo1"
Top = 120
Width = 1935
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "连接类型"
Height = 180
Index = 4
Left = 240
TabIndex = 4
Top = 1680
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "发送数据速度"
Height = 180
Index = 3
Left = 240
TabIndex = 3
Top = 1320
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "接收数据速度"
Height = 180
Index = 2
Left = 240
TabIndex = 2
Top = 960
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "能否达到"
Height = 180
Index = 1
Left = 240
TabIndex = 1
Top = 705
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "目标:"
Height = 180
Index = 0
Left = 240
TabIndex = 0
Top = 180
Width = 540
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Combo1_Click()
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Text1(3).Text = ""
End Sub
Private Sub Command1_Click()
'注意:本函数只适用于TCP/IP连接
'如果不需要QOC信息,可以传递一个空指针,
'并将该参数声明为Any类型
Dim result As Long
Dim tmp As String
Dim qoc As QOCINFO
With qoc
.dwSize = Len(qoc)
End With
result = IsDestinationReachable((Combo1.Text), qoc)
With qoc
Select Case .dwFlags
Case NETWORK_ALIVE_LAN: tmp = "有一个或多个LAN网卡"
Case NETWORK_ALIVE_WAN: tmp = "有一个或多个RAS连接"
Case NETWORK_ALIVE_AOL: tmp = "已连接到美国在线网络"
Case Else
End Select
Text1(0).Text = Format$(result, "Yes/No")
Text1(1).Text = FormatNumber(.dwInSpeed, 0) & "字节/秒"
Text1(2).Text = FormatNumber(.dwOutSpeed, 0) & "字节/秒"
Text1(3).Text = tmp
End With
End Sub
Private Sub Form_Load()
Dim c As Integer
Dim TotalRequired As Integer
TotalRequired = 4
'创建TextBox空件数组
For c = 0 To TotalRequired - 1
'由于数组元素(0)已存在,无需再装载它
If c > 0 Then Load Text1(c)
'定位新创建的空件,以及相应的Label空件
Text1(c).Move 1600, 600 + (c * 300), 3615
Label1(c).Move 200, 300 + (c * 300)
'显示新创建的空件
Text1(c).Text = ""
Text1(c).Visible = True
Next
Label1(4).Move 200, 300 + (4 * 300)
With Combo1
.Clear
.Move 1600, 260, 3615
.AddItem "100.100.0.171"
.AddItem "www.microsoft.com"
.AddItem "www.mvps.org"
.AddItem "www.yahoo.com"
.AddItem "192.168.0.1"
.AddItem "192.168.0.100"
.AddItem "www.gov.on.ca"
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -