📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "由主机名获取IP地址"
ClientHeight = 2490
ClientLeft = 45
ClientTop = 330
ClientWidth = 3480
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2490
ScaleWidth = 3480
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 2055
Left = 240
TabIndex = 0
Top = 120
Width = 3015
Begin VB.CommandButton Command1
Caption = "运行(&R)"
Default = -1 'True
Height = 375
Left = 1080
TabIndex = 5
Top = 1440
Width = 1095
End
Begin VB.TextBox Text2
Height = 270
Left = 960
Locked = -1 'True
TabIndex = 4
Top = 960
Width = 1695
End
Begin VB.TextBox Text1
Height = 270
Left = 960
TabIndex = 2
Text = "请输入主机名"
Top = 600
Width = 1695
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "IP地址"
Height = 180
Left = 240
TabIndex = 3
Top = 1080
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "主机名"
Height = 180
Left = 240
TabIndex = 1
Top = 600
Width = 540
End
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 sHostName As String
If SocketsInitialize() Then
sHostName = Trim(Text1.Text)
Text2.Text = GetIPFromHostName(sHostName)
SocketsCleanup
Else
MsgBox "32位Windows的Windows Sockets无响应"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -