📄 main.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form main
BorderStyle = 3 'Fixed Dialog
Caption = "使用UPD发送信息"
ClientHeight = 2232
ClientLeft = 48
ClientTop = 336
ClientWidth = 4272
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2232
ScaleWidth = 4272
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 285
Left = 1440
TabIndex = 6
Top = 600
Width = 2655
End
Begin MSWinsockLib.Winsock Winsock1
Left = 1080
Top = 3000
_ExtentX = 593
_ExtentY = 593
_Version = 393216
Protocol = 1
End
Begin VB.CommandButton Command2
Caption = "退出程序"
Enabled = 0 'False
Height = 372
Left = 1920
TabIndex = 3
Top = 1680
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "开始发送"
Height = 372
Left = 720
TabIndex = 2
Top = 1680
Width = 1215
End
Begin VB.TextBox Text2
Height = 285
Left = 1440
TabIndex = 1
Top = 1080
Width = 2655
End
Begin VB.TextBox Text1
Height = 285
Left = 1440
TabIndex = 0
Top = 240
Width = 2655
End
Begin VB.Label Label3
Caption = "端口地址:"
Height = 372
Left = 120
TabIndex = 7
Top = 600
Width = 972
End
Begin VB.Label Label2
Caption = "信息内容:"
Height = 372
Left = 120
TabIndex = 5
Top = 1080
Width = 1092
End
Begin VB.Label Label1
Caption = "IP地址:"
Height = 372
Left = 120
TabIndex = 4
Top = 240
Width = 972
End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Sub Timeout(interval)
'Pauses for a given time
Dim Current
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
Private Sub Command1_Click()
'sets buttons
Command2.Enabled = True
Command1.Enabled = False
'setups winsock
Winsock1.LocalPort = 2043
Winsock1.RemoteHost = Text1
Winsock1.RemotePort = Text3
'sets loop
Do
DoEvents
'sends data
Winsock1.SendData Text2
DoEvents
'checks speed set
Timeout (0.6)
Loop While Command1.Enabled = False
'closes winsock
Winsock1.Close
Command1.Enabled = True
Command2.Enabled = False
Exit Sub
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -