⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 VB毕业设计源码 适合VB爱好者 及关大做毕业设计的学生朋友 使用与参考
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Ping"
   ClientHeight    =   5340
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3975
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5340
   ScaleWidth      =   3975
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text4 
      Height          =   375
      Index           =   5
      Left            =   1440
      TabIndex        =   9
      Text            =   "Text4"
      Top             =   4200
      Width           =   2295
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Index           =   4
      Left            =   1440
      TabIndex        =   8
      Text            =   "Text4"
      Top             =   3720
      Width           =   2295
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Index           =   3
      Left            =   1440
      TabIndex        =   7
      Text            =   "Text4"
      Top             =   3240
      Width           =   2295
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Index           =   2
      Left            =   1440
      TabIndex        =   6
      Text            =   "Text4"
      Top             =   2760
      Width           =   2295
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Index           =   1
      Left            =   1440
      TabIndex        =   5
      Text            =   "Text4"
      Top             =   2280
      Width           =   2295
   End
   Begin VB.TextBox Text4 
      Height          =   375
      Index           =   0
      Left            =   1440
      TabIndex        =   4
      Text            =   "Text4"
      Top             =   1800
      Width           =   2295
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1440
      TabIndex        =   3
      Text            =   "Text3"
      Top             =   1080
      Width           =   2295
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   1440
      TabIndex        =   2
      Text            =   "Text2"
      Top             =   600
      Width           =   2295
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1440
      TabIndex        =   1
      Text            =   "Text1"
      Top             =   120
      Width           =   2295
   End
   Begin VB.CommandButton Command1 
      Caption         =   "运行(&R)"
      Height          =   375
      Left            =   1920
      TabIndex        =   0
      Top             =   4800
      Width           =   1215
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "数据指针"
      Height          =   180
      Left            =   360
      TabIndex        =   18
      Top             =   4297
      Width           =   720
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "返回数据"
      Height          =   180
      Left            =   360
      TabIndex        =   17
      Top             =   3817
      Width           =   720
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "数据包大小"
      Height          =   180
      Left            =   240
      TabIndex        =   16
      Top             =   3337
      Width           =   900
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Round Trip时间"
      Height          =   180
      Left            =   0
      TabIndex        =   15
      Top             =   2880
      Width           =   1260
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "地址(十)"
      Height          =   180
      Left            =   240
      TabIndex        =   14
      Top             =   2377
      Width           =   720
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "返回状态"
      Height          =   180
      Left            =   240
      TabIndex        =   13
      Top             =   1897
      Width           =   720
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "发送数据"
      Height          =   180
      Left            =   240
      TabIndex        =   12
      Top             =   1177
      Width           =   720
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "IP地址"
      Height          =   180
      Left            =   240
      TabIndex        =   11
      Top             =   697
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "主机名"
      Height          =   180
      Left            =   240
      TabIndex        =   10
      Top             =   217
      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 Command1_Click()
    Dim ECHO As ICMP_ECHO_REPLY
   Dim pos As Long
   Dim success As Long
   Dim sIPAddress As String
   If SocketsInitialize() Then
     '将主机名转换为IP地址
      sIPAddress = GetIPFromHostName(Text1.Text)
      Text2.Text = sIPAddress
     '用传递过来的地址、使用的文本和ECHO结构去ping得到的ip
      success = Ping(sIPAddress, (Text3.Text), ECHO)
     '显示结果
      Text4(0).Text = GetStatusCode(success)
      Text4(1) = ECHO.Address
      Text4(2) = ECHO.RoundTripTime & " 毫秒"
      Text4(3) = ECHO.DataSize & " 字节"
      If Left$(ECHO.Data, 1) <> Chr$(0) Then
         pos = InStr(ECHO.Data, Chr$(0))
         Text4(4) = Left$(ECHO.Data, pos - 1)
      End If
      Text4(5) = ECHO.DataPointer
      SocketsCleanup
   Else
        MsgBox "32位Windows套接字初始化失败"
   End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -