📄 frmmain.frm
字号:
VERSION 5.00
Begin VB.Form FrmMain
BorderStyle = 1 'Fixed Single
Caption = "杭州爱赛德软件技术有限公司"
ClientHeight = 6195
ClientLeft = 5280
ClientTop = 2595
ClientWidth = 6390
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6195
ScaleWidth = 6390
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame2
Caption = "发送信息:"
Height = 2175
Left = 0
TabIndex = 8
Top = 0
Width = 6375
Begin VB.Timer ReadFailedMsgTimer
Enabled = 0 'False
Interval = 1000
Left = 4560
Top = 1680
End
Begin VB.Timer ReadNextSendMsgTimer
Enabled = 0 'False
Interval = 1000
Left = 4080
Top = 1680
End
Begin VB.TextBox EdtUnSendCount
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 15
Top = 1680
Width = 2175
End
Begin VB.TextBox EdtNextSendMsg
Enabled = 0 'False
Height = 375
Left = 1320
TabIndex = 14
Top = 1200
Width = 4815
End
Begin VB.TextBox EdtMessage
Height = 375
Left = 1320
TabIndex = 13
Top = 720
Width = 4815
End
Begin VB.TextBox EdtMobile
Height = 375
Left = 1320
TabIndex = 12
Top = 240
Width = 4815
End
Begin VB.CommandButton BtnSend
Caption = "发送"
Enabled = 0 'False
Height = 375
Left = 4920
TabIndex = 1
Top = 1680
Width = 1215
End
Begin VB.Timer ReadNewMsgTimer
Enabled = 0 'False
Interval = 1000
Left = 3600
Top = 1680
End
Begin VB.Label Label5
Caption = "未发数目:"
Height = 375
Left = 240
TabIndex = 17
Top = 1680
Width = 1095
End
Begin VB.Label Label4
Caption = "下条短信:"
Height = 375
Left = 240
TabIndex = 16
Top = 1200
Width = 1095
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "手机号码:"
Height = 375
Left = 240
TabIndex = 10
Top = 240
Width = 1095
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "发送内容:"
Height = 375
Left = 240
TabIndex = 9
Top = 720
Width = 1095
End
End
Begin VB.TextBox EdtLog
Height = 1785
Left = 0
MultiLine = -1 'True
TabIndex = 7
Top = 4080
Width = 6375
End
Begin VB.Frame Frame1
Caption = "模块管理:"
Height = 1695
Left = 0
TabIndex = 0
Top = 2280
Width = 6375
Begin VB.CommandButton BtnSCA
Caption = "短信中心"
Enabled = 0 'False
Height = 375
Left = 4920
TabIndex = 5
Top = 1200
Width = 1215
End
Begin VB.ComboBox ComboBox1
Height = 330
ItemData = "FrmMain.frx":0000
Left = 1320
List = "FrmMain.frx":0007
TabIndex = 2
Text = "1"
Top = 740
Width = 3135
End
Begin VB.CommandButton BtnClose
Caption = "关闭模块"
Enabled = 0 'False
Height = 375
Left = 4920
TabIndex = 4
Top = 720
Width = 1215
End
Begin VB.CommandButton BtnOpen
Caption = "打开模块"
Height = 375
Left = 4920
TabIndex = 3
Top = 240
Width = 1215
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "串口号:"
Height = 210
Left = 360
TabIndex = 6
Top = 795
Width = 840
End
End
Begin VB.Label LblMsg
BorderStyle = 1 'Fixed Single
Height = 300
Left = 0
TabIndex = 11
Top = 5880
Width = 6375
End
End
Attribute VB_Name = "FrmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' TestSMS.vbp
' VB Example constructed upon AscendSMS.dll
' Hangzhou Ascend Wireless Team
' Copyright (c) 2001-2003 Ascend Software Technology, Co.,Ltd.
' The Initial Developer of the Original Code is Ascend Software Technology, Co.,Ltd.
' Version 1.0
' ZhuJun
' 07/08/2001
Private Sub BtnClose_Click()
Dim Val As Integer
Val = CloseComm(CLng(ComboBox1.Text))
If Val = 0 Then
LblMsg.Caption = "关闭模块成功"
ReadNewMsgTimer.Enabled = False
ReadFailedMsgTimer.Enabled = False
ReadNextSendMsgTimer.Enabled = False
BtnOpen.Enabled = True
BtnClose.Enabled = False
BtnSend.Enabled = False
BtnSCA.Enabled = False
Else
LblMsg.Caption = "关闭模块失败"
End If
End Sub
Private Sub BtnOpen_Click()
Dim Val As Long
Val = OpenComm(CLng(ComboBox1.Text))
If Val = 0 Then
LblMsg.Caption = "打开模块成功"
BtnOpen.Enabled = False
BtnClose.Enabled = True
BtnSend.Enabled = True
BtnSCA.Enabled = True
ReadNewMsgTimer.Enabled = True
ReadFailedMsgTimer.Enabled = True
ReadNextSendMsgTimer.Enabled = True
Else
LblMsg.Caption = "打开模块失败"
End If
End Sub
Private Sub BtnSCA_Click()
Dim SCA As String
SCA = String(255, " ")
'设置短信中心示例
'If Not SetSCA(CLng(ComboBox1.Text), "+8613800571500") Then
' LblMsg.Caption = "设置短信中心号码失败"
'Else
' LblMsg.Caption = "已成功设置短信中心号码"
'End If
If GetSCA(CLng(ComboBox1.Text), SCA) Then
If SCA <> " " Then
LblMsg.Caption = "当前的短信中心号码为:" + SCA
End If
Else
LblMsg.Caption = "读取短信中心号码失败"
End If
End Sub
Private Sub BtnSend_Click()
If SendMsg(CLng(ComboBox1.Text), EdtMessage.Text, EdtMobile.Text, 1, True) = 0 Then
LblMsg.Caption = "发送成功"
Else
LblMsg.Caption = "发送失败"
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
ForceCloseComm (CLng(ComboBox1.Text))
End Sub
Private Sub ReadFailedMsgTimer_Timer()
Dim FailedMsg As String
FailedMsg = String(255, " ")
If GetFailedMsg(CLng(ComboBox1.Text), FailedMsg) Then
If FailedMsg <> "" Then
If EdtLog.Text <> "" Then
EdtLog.Text = EdtLog.Text + vbCrLf + "发送短信失败:" + FailedMsg
Else
EdtLog.Text = "发送短信失败:" + FailedMsg
End If
End If
End If
End Sub
Private Sub ReadNewMsgTimer_Timer()
Dim NewMsg As String
NewMsg = String(255, " ")
If GetNewMsg(CLng(ComboBox1.Text), NewMsg) Then
If NewMsg <> "" Then
If EdtLog.Text <> "" Then
EdtLog.Text = EdtLog.Text + vbCrLf + "收到短信:" + NewMsg
Else
EdtLog.Text = "收到短信:" + NewMsg
End If
End If
End If
End Sub
Private Sub ReadNextSendMsgTimer_Timer()
Dim NextSendMsg As String
NextSendMsg = String(255, " ")
EdtUnSendCount.Text = GetUnSendCount(CLng(ComboBox1.Text))
If GetNextSendMsg(CLng(ComboBox1.Text), NextSendMsg, False) Then
EdtNextSendMsg.Text = NextSendMsg
Else
EdtNextSendMsg.Text = ""
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -