📄 form1.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
ClientHeight = 7740
ClientLeft = 45
ClientTop = 330
ClientWidth = 8205
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7740
ScaleWidth = 8205
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command3
Caption = "发送"
Height = 375
Left = 6240
TabIndex = 9
Top = 360
Width = 855
End
Begin VB.TextBox Text5
Height = 375
Left = 5160
TabIndex = 8
Text = "="
Top = 360
Width = 855
End
Begin VB.TextBox Text4
Height = 375
Left = 3360
TabIndex = 7
Text = "0"
Top = 360
Width = 615
End
Begin VB.Frame Frame1
Caption = "参数设置"
Height = 1215
Left = 480
TabIndex = 2
Top = 120
Width = 2655
Begin VB.TextBox Text3
Height = 375
Left = 960
TabIndex = 6
Text = "1"
Top = 720
Width = 615
End
Begin VB.CommandButton Command2
Caption = "重置"
Height = 375
Left = 1800
TabIndex = 4
Top = 480
Width = 735
End
Begin VB.TextBox Text2
Height = 390
Left = 360
TabIndex = 3
Text = "2400,e,8,1"
Top = 240
Width = 1215
End
Begin VB.Label Label1
Caption = "端口:"
Height = 255
Left = 240
TabIndex = 5
Top = 840
Width = 615
End
End
Begin VB.CommandButton Command1
Caption = "清空"
Height = 375
Left = 4080
TabIndex = 1
Top = 360
Width = 855
End
Begin RichTextLib.RichTextBox Text1
Height = 6015
Left = 480
TabIndex = 0
Top = 1440
Width = 7335
_ExtentX = 12938
_ExtentY = 10610
_Version = 393217
Enabled = -1 'True
ScrollBars = 2
TextRTF = $"Form1.frx":0000
End
Begin MSCommLib.MSComm MSComm
Left = 7560
Top = 600
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
RThreshold = 1
BaudRate = 2400
ParitySetting = 2
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim str As String
Private Sub Command1_Click()
Text1.Text = ""
Text4 = 0
End Sub
Private Sub Command2_Click()
If MSComm.PortOpen = True Then
MSComm.PortOpen = False
End If
MSComm.CommPort = Int(Text3.Text)
MSComm.Settings = Text2.Text
MSComm.InputLen = 0
MSComm.PortOpen = True
End Sub
Private Sub Command3_Click()
MSComm.Output = Text5.Text
End Sub
Private Sub Form_Load()
Dim Instring As String
MSComm.CommPort = 1
MSComm.Settings = "2400,e,8,1"
MSComm.InputLen = 0
MSComm.PortOpen = True
Text2.Text = MSComm.Settings
End Sub
Private Sub Form_Unload(cancel As Integer)
If MSComm.PortOpen = True Then
MSComm.PortOpen = False
End If
End Sub
Private Sub mscomm_oncomm()
Dim s As String
If readcom(s) Then
End If
End Sub
Function readcom(s As String) As Integer
On Error Resume Next
If MSComm.InBufferCount Then
MSComm.InputLen = MSComm.InBufferCount
s = MSComm.Input
Text1.Text = Text1.Text + s
End If
Text4.Text = Len(Text1.Text)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -