📄 form1.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
Caption = "Wav Sender"
ClientHeight = 3750
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3750
ScaleWidth = 4680
StartUpPosition = 2 'CenterScreen
Begin MSComctlLib.ProgressBar procBar1
Height = 255
Left = 0
TabIndex = 4
Top = 3480
Width = 4695
_ExtentX = 8281
_ExtentY = 450
_Version = 393216
Appearance = 1
End
Begin VB.Frame Frame1
Caption = "Information"
Height = 2175
Left = 600
TabIndex = 2
Top = 840
Width = 3255
Begin VB.TextBox Text1
Height = 1815
Left = 120
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Text = "Form1.frx":0000
Top = 240
Width = 3015
End
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1
Left = 4200
Top = 1200
End
Begin MSCommLib.MSComm comm1
Left = 4200
Top = 1800
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
End
Begin MSComDlg.CommonDialog commDialog1
Left = 4200
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
Filter = "音频文件 (*.wav)|*.wav"
End
Begin VB.CommandButton cmdSend
Caption = "发送"
Height = 375
Left = 2520
TabIndex = 1
Top = 240
Width = 1095
End
Begin VB.CommandButton cmdChoose
Caption = "选择文件"
Height = 375
Left = 720
TabIndex = 0
Top = 240
Width = 1095
End
Begin VB.Label lab1
Caption = "发送进度"
Height = 255
Left = 120
TabIndex = 5
Top = 3120
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdChoose_Click()
Dim fileName As String
Dim oldFile As String
oldFile = commDialog1.fileName
commDialog1.ShowOpen
fileName = commDialog1.fileName
If fileName = oldFile Then Exit Sub
Text1.Text = Text1.Text + "已选择文件'" + fileName + "'。" + Chr(13) + Chr(10)
Text1.Text = Text1.Text + "准备发送数据。" + Chr(13) + Chr(10)
Module1.GetFileData fileName
Text1.Text = Text1.Text + "已获得文件数据。" + Chr(13) + Chr(10)
Module1.Fbc
Text1.Text = Text1.Text + "已将文件数据转换为折叠二进制码。" + Chr(13) + Chr(10)
Module1.SetCommProperty comm1
Text1.Text = Text1.Text + "已设置串口属性。" + Chr(13) + Chr(10)
End Sub
Private Sub cmdSend_Click()
If comm1.PortOpen = False Then comm1.PortOpen = True
Text1.Text = Text1.Text + "开始发送数据。" + Chr(13) + Chr(10)
procBar1.Enabled = True
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Text1.Text = "请选择音频文件。" + Chr(13) + Chr(10)
procBar1.Enabled = False
Module1.InitRow
End Sub
Private Sub Timer1_Timer()
If SendData(comm1, procBar1, lab1) <> True Then
Text1.Text = Text1.Text + "发送数据完毕。" + Chr(13) + Chr(10)
Timer1.Enabled = False
comm1.PortOpen = False
procBar1.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -