📄 main.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form mainForm
BorderStyle = 1 'Fixed Single
Caption = "at命令调试精灵"
ClientHeight = 8010
ClientLeft = 45
ClientTop = 330
ClientWidth = 8745
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 8010
ScaleWidth = 8745
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "at命令操作"
Height = 6495
Left = 0
TabIndex = 10
Top = 1440
Width = 8655
Begin VB.TextBox atstrt
Height = 375
Left = 840
TabIndex = 13
Top = 360
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "执行"
Height = 375
Left = 3120
TabIndex = 12
Top = 360
Width = 855
End
Begin VB.TextBox atjg
Height = 5295
Left = 120
MultiLine = -1 'True
TabIndex = 11
Top = 1080
Width = 3855
End
Begin MSComctlLib.ListView atcommanddl
Height = 5355
Left = 4320
TabIndex = 16
Top = 1080
Width = 4095
_ExtentX = 7223
_ExtentY = 9446
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
FullRowSelect = -1 'True
GridLines = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
Begin VB.Label Label2
Caption = "at指令"
Height = 375
Left = 240
TabIndex = 14
Top = 360
Width = 615
End
End
Begin VB.Frame Frame1
Caption = "短信设备连接"
Height = 1305
Left = 0
TabIndex = 0
Top = 0
Width = 8625
Begin VB.Timer viewresutTimer
Enabled = 0 'False
Interval = 100
Left = 6240
Top = 840
End
Begin VB.Timer runatTimer
Enabled = 0 'False
Interval = 2000
Left = 5640
Top = 840
End
Begin MSCommLib.MSComm MSComm1
Left = 3480
Top = 720
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
End
Begin VB.CommandButton cmdDisConnect
Caption = "断开"
Enabled = 0 'False
Height = 300
Left = 6600
TabIndex = 5
Top = 480
Width = 615
End
Begin VB.CommandButton cmdConnect
Caption = "连接"
Height = 300
Left = 5880
TabIndex = 4
Top = 480
Width = 615
End
Begin VB.TextBox txtCommPort
Height = 300
Left = 4920
TabIndex = 3
Text = "1"
Top = 480
Width = 855
End
Begin VB.TextBox txtMsgCenter
Height = 300
Left = 1320
TabIndex = 2
Text = "+8613800755500"
Top = 480
Width = 1455
End
Begin VB.ComboBox cmbBaud
Height = 300
ItemData = "main.frx":0000
Left = 3360
List = "main.frx":001C
TabIndex = 1
Text = "9600"
Top = 480
Width = 1095
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Height = 255
Left = 4680
TabIndex = 15
Top = 960
Width = 3375
End
Begin VB.Label Label6
Caption = "端口"
Height = 255
Left = 4440
TabIndex = 9
Top = 480
Width = 495
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "短信中心号码:"
Height = 255
Index = 4
Left = 120
TabIndex = 8
Top = 480
Width = 1260
End
Begin VB.Label Label9
Caption = "波特率"
Height = 255
Left = 2760
TabIndex = 7
Top = 480
Width = 615
End
Begin VB.Label Label10
Caption = "注:如果连接没反映请换波特率试一下"
Height = 255
Left = 120
TabIndex = 6
Top = 960
Width = 3135
End
End
End
Attribute VB_Name = "mainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public openstate As Boolean
Public OnCommstr As String 'OnComm事件里所接受的当前字符
Dim atcommandstr As String '保存所有的要执行的at指令
Dim resultstr As String '保存返回结果
Dim atcommanddlindex As Integer
Dim regEx As RegExp
Private Sub cmdConnect_Click()
On Error GoTo e
If txtMsgCenter.Text = "" Then
MsgBox ("请输入短信服务中心号码")
Exit Sub
End If
If txtCommPort.Text = "" Then
MsgBox ("请输入串口号")
Exit Sub
End If
If cmbBaud.Text = "" Then
MsgBox ("请输入波特率")
Exit Sub
End If
If Not (IsNumeric(cmbBaud.Text)) Then
MsgBox ("波特率必须为数字")
Exit Sub
End If
If Not (IsNumeric(txtCommPort.Text)) Then
MsgBox ("串口号必须为数字")
Exit Sub
End If
MSComm1.CommPort = Int(txtCommPort.Text) ';//选择COM1(1-COM1,2-COM2……)打开端口之前设置 CommPort 属性,这里容易出错
MSComm1.InBufferSize = 1024 ';//设置接受缓冲区为1024字节
MSComm1.OutBufferSize = 512 ';//设置发送缓冲区为512字节
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -