📄 form1.frm
字号:
Height = 1335
Left = 2880
TabIndex = 48
Top = 3960
Width = 975
End
Begin VB.Label Label9
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "读短消息"
Height = 180
Left = 5400
TabIndex = 36
Top = 3525
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "通讯断口:"
Height = 180
Left = 1224
TabIndex = 34
Top = 4872
Width = 900
End
Begin VB.Label Label7
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
Caption = "请按“*”解键盘---------------MY GOD"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 372
Left = 4992
TabIndex = 33
Top = 5448
Width = 4932
End
Begin VB.Label Label6
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
Caption = "手机秘书台服务工具---MY MM"
BeginProperty Font
Name = "Arial"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 372
Left = 0
TabIndex = 32
Top = 984
Width = 5172
End
Begin VB.Shape Shape1
BackStyle = 1 'Opaque
BorderStyle = 6 'Inside Solid
FillStyle = 0 'Solid
Height = 1212
Left = 2232
Shape = 4 'Rounded Rectangle
Top = 600
Width = 372
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "发送汉字"
Height = 180
Left = 4200
TabIndex = 16
Top = 3525
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "发送内容:"
Height = 180
Left = 3120
TabIndex = 7
Top = 2085
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "接受方手机号:"
Height = 180
Left = 2880
TabIndex = 6
Top = 1635
Width = 1260
End
Begin VB.Label Lbltypecall
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "发送英文"
Height = 180
Left = 6690
TabIndex = 5
Top = 3525
Width = 720
End
Begin VB.Label lblCaption
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Label2"
ForeColor = &H8000000E&
Height = 180
Left = 60
TabIndex = 4
Top = 390
Width = 540
End
Begin VB.Label lblCaption1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Label2"
Height = 180
Left = 0
TabIndex = 3
Top = 30
Width = 540
End
Begin VB.Image imgBtnMin
Height = 225
Left = 4530
Top = 120
Visible = 0 'False
Width = 225
End
Begin VB.Image imgBtnClose
Height = 225
Left = 4875
Top = 120
Width = 225
End
Begin VB.Image imgBL
Height = 120
Left = 7335
Top = 2010
Width = 120
End
Begin VB.Image imgBR
Height = 120
Left = 7950
Top = 2100
Width = 120
End
Begin VB.Image imgTL
Height = 390
Left = 7290
Top = 2310
Width = 120
End
Begin VB.Image imgTR
Height = 390
Left = 7890
Top = 2160
Width = 120
End
Begin VB.Image imgR
Height = 4500
Left = 8430
Stretch = -1 'True
Top = 0
Width = 90
End
Begin VB.Image imgB
Height = 120
Left = 6450
Stretch = -1 'True
Top = 645
Width = 7275
End
Begin VB.Image imgL
Height = 4500
Left = 7485
Stretch = -1 'True
Top = 240
Width = 90
End
Begin VB.Image ImgBtnup
Height = 252
Left = 2808
Picture = "Form1.frx":0062
Top = 1776
Visible = 0 'False
Width = 900
End
Begin VB.Image ImgBtnDn
Height = 252
Left = 2712
Picture = "Form1.frx":089A
Top = 2196
Visible = 0 'False
Width = 900
End
Begin VB.Image imgCaptionBar
Appearance = 0 'Flat
Height = 390
Left = 210
Stretch = -1 'True
Top = 30
Width = 5430
End
Begin VB.Image Cmdsend
Height = 252
Left = 6600
Picture = "Form1.frx":113A
Top = 3480
Width = 900
End
Begin VB.Image cmdsendc
Height = 252
Left = 3996
Picture = "Form1.frx":1972
Top = 3480
Width = 900
End
Begin VB.Image cmdread
Height = 252
Left = 5316
Picture = "Form1.frx":21AA
Top = 3480
Width = 900
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 strSendText As String
Private strtext As String
Private strtemp3 As String
Private strtemp4 As String
Private stopDelay As Boolean
Private IntLen As String
Private Gmsloadstr As String
Private Strarr() As Byte
Private strarrtemp() As Byte
'DefInt A-Z
Dim CancelFlag
Private SbTelephone As String
Private Sub Delay(ByVal sec As Single)
Dim tm1 As Date, tm2 As Date, v1 As Variant
v1 = 24
v1 = v1 * 60
v1 = v1 * 60
tm1 = Now
Do
tm2 = Now - tm1
DoEvents
If tm2 * v1 > sec Then Exit Do
Loop Until stopDelay
End Sub
Private Sub GsmSendMessage(ByVal strtemp As String)
' MSComm1.CommPort = Val(Cmbcom.Text)
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeText
IntLen = Len(strtemp) / 2 - 1
MSComm1.Output = "AT+CMGF=0" & vbCrLf
Delay 0.5 '原为1.5
MSComm1.Output = "AT+CMGS=" & IntLen & vbCrLf
Delay 0.5 '原为0.5
MSComm1.Output = strtemp & Chr(26)
Delay 2 '原为2.0
End Sub
Private Sub GsmSendMessageEnglish(ByVal strtemp As String)
' MSComm1.CommPort = Val(Cmbcom.Text)
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeText
MSComm1.Output = "AT+CMGF=1" & vbCrLf
Delay 0.5 '原为1.5
MSComm1.Output = "AT+CMGS=" & Trim(TxtPhone.Text) & vbCrLf
Delay 0.5 '原为0.5
MSComm1.Output = strtemp & Chr(26)
Delay 2 '原为2.0
End Sub
Private Sub Proccess(ByVal strTel As String, ByVal strSend As String)
Dim strtemp, strtemp1, strtemp2, strtemp3, Temp, temp1, temp2 As String
Dim strbyte As Byte
Dim i As Integer
Dim bytSource() As Byte
Dim lngCount As Long
strtemp = strTel
strtemp = strtemp & "FFFFFFFFFFFF"
strtemp = Left(strtemp, 12)
For i = 1 To 12 Step 2
strtemp1 = Mid(strtemp, i, 2)
strtemp2 = strtemp2 & Right(strtemp1, 1) & Left(strtemp1, 1)
Next i
strSendText = "0011000B81" & strtemp2 & "0008AA"
If Check2.Value = vbChecked Then
bytSource = strSend
Else
bytSource = TxtCont.Text
End If
i = UBound(bytSource) + 1
IntLen = Right("00" & Hex(i), 2)
strtemp = Right("00" & Hex(UBound(bytSource) + 1), 2)
strtemp3 = ""
For i = 0 To UBound(bytSource) Step 2
Temp = Right("00" & Hex(bytSource(i)), 2)
temp1 = Right("00" & Hex(bytSource(i + 1)), 2)
temp2 = temp1 & Temp
strtemp3 = strtemp3 & temp2
Next i
strSendText = strSendText & strtemp & strtemp3
End Sub
Private Sub Check2_Click()
If Check2.Value = vbChecked Then
Frame2.Visible = True
Label13.Visible = True
Else
Frame2.Visible = False
Label13.Visible = False
End If
End Sub
Private Sub Cmbcom_Change()
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
MSComm1.CommPort = Val(Cmbcom.Text)
End Sub
Private Sub Cmbcom_Click()
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
MSComm1.CommPort = Val(Cmbcom.Text)
End Sub
Private Sub Cmbfs_Click()
Dim strtemp, strtext As String
strtemp = Trim(Txtsjhm.Text)
strtext = "**50000" & Trim(Cmbbdz.Text) & "55031006"
If Cmbyg.Text = "是" Then
strtext = strtext & "6f0d"
Else
strtext = strtext & "700d"
End If
Proccess strtemp, strtext
GsmSendMessage strSendText
' Timer6.Enabled = True
End Sub
Private Sub cmdread_Click()
Read_message
End Sub
Private Sub Cmdsend_Click()
Dim strtemp, strtext As String
strtemp = Trim(TxtPhone.Text)
strtext = Trim(TxtCont.Text)
GsmSendMessageEnglish strtext
End Sub
Private Sub Command2_Click()
TxtCont.Text = ""
If Check1.Value = 1 Then
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeText
MSComm1.Output = "AT+CMGF=1" & vbCrLf
Sleep 200
MSComm1.Output = "AT+CMGl=ALL" & vbCrLf
Else
Read_message
End If
End Sub
Private Sub cmdsendc_Click()
Dim strtemp, strtext As String
strtemp = Trim(TxtPhone.Text)
strtext = Trim(TxtCont.Text)
Proccess strtemp, strtext
GsmSendMessage strSendText
End Sub
Private Sub Cmdtz_Click()
End
End Sub
Private Sub Commandr_Click()
TxtCont.Text = ""
If Check1.Value = 1 Then
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
MSComm1.InputMode = comInputModeText
MSComm1.Output = "AT+CMGF=1" & vbCrLf
Sleep 200
MSComm1.Output = "AT+CMGl=ALL" & vbCrLf
Else
Read_message
End If
End Sub
Private Sub Form_Activate()
cmdastrik.SetFocus
End Sub
Private Sub Form_Load()
Dim str As String
SkinSet Me, "手机控制中心"
dial_num.Text = Format(Now, "DD-MM-YYYY HH:MM:SS") & Format(Now, "HH:MM:SS")
Cmbyg.ListIndex = 0
Cmbbdz.ListIndex = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
Unload FrmTmp
End
End Sub
Private Sub Image1_Click()
End Sub
Private Sub imgBtnClose_Click()
Unload Me
End Sub
Private Sub Label5_Click()
cmdsendc_Click
End Sub
Private Sub Label9_Click()
cmdread_Click
End Sub
Private Sub Lbltypecall_Click()
Cmdsend_Click
End Sub
Private Sub MSComm1_OnComm()
Dim by As Variant
Dim n1 As Integer, n2 As Integer
by = MSComm1.Input
Dim i As Integer
i = InStr(by, "+CMTI:")
If i > 0 Then
If Check2.Value = vbChecked Then
Commandr_Click
Else
cmdread_Click
End If
Exit Sub
End If
If Check2.Value = vbChecked Then
Txt485.Text = Txt485.Text & CStr(by)
Txt485.SelStart = Len(Txt485.Text)
Else
TxtCom.Text = TxtCom.Text & CStr(by)
TxtCom.SelStart = Len(TxtCom.Text)
End If
Gmsloadstr = Gmsloadstr & by
n1 = InStr(1, Gmsloadstr, vbCrLf & "OK" & vbCrLf)
n2 = InStr(1, Gmsloadstr, vbCrLf & "ERROR" & vbCrLf)
If n1 > 0 Then
AnalysisGmsPDU Gmsloadstr
End If
End Sub
Private Sub Read_message()
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -