📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command4
Caption = "释放"
Height = 495
Left = 2760
TabIndex = 3
Top = 240
Width = 1335
End
Begin VB.CommandButton Command3
Caption = "发送"
Height = 495
Left = 2760
TabIndex = 2
Top = 1440
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "接收"
Height = 495
Left = 600
TabIndex = 1
Top = 1440
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "测试联接"
Height = 495
Left = 600
TabIndex = 0
Top = 240
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sms As New tmsms.sms
Private Sub Command1_Click()
On Error Resume Next
Dim i As Integer
i = 0
Dim msg
i = sms.SmsIni(2, 19200, msg) '参数分别为端口号、波特率、手机型号(数据类型要用变体类型)
If i = 1 Then
MsgBox msg
Command2.Enabled = True
Command3.Enabled = True
Else
MsgBox "联接失败"
End If
End Sub
Private Sub Command2_Click()
Dim i As Integer
Dim msg
i = 0
i = sms.SmsReceive("4", msg) '0未读1已读2待发3已发4全部,msg要定为变体类型
If i = 1 Then
MsgBox msg
Else
MsgBox "读取失败"
End If
End Sub
Private Sub Command3_Click()
Dim i As Integer
Dim msg As String
i = 0
msg = "测试"
i = sms.SmsSend("13600000000", msg) '接收方手机号,短信内容
If i = 1 Then
MsgBox "发送成功"
Else
MsgBox "发送失败"
End If
End Sub
Private Sub Command4_Click()
sms.Despose '完毕必须释放,否则出错
End Sub
Private Sub Form_Load()
Command2.Enabled = False
Command3.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -