⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 PDU编码的VB实例 适用于手机短信编译的学习
💻 FRM
字号:
VERSION 5.00
Object = "{DDB23D40-51FC-4EDE-B9FB-C563AD250FF8}#1.0#0"; "锐方超级SMS控件.ocx"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "锐方超级SMS控件演示 V2.0"
   ClientHeight    =   7005
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   10800
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   7005
   ScaleWidth      =   10800
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame4 
      Caption         =   "进制转换"
      Height          =   3375
      Left            =   6360
      TabIndex        =   22
      Top             =   3600
      Width           =   4095
      Begin VB.ComboBox Combo2 
         Height          =   300
         ItemData        =   "Form1.frx":0000
         Left            =   120
         List            =   "Form1.frx":0016
         Style           =   2  'Dropdown List
         TabIndex        =   26
         Top             =   2925
         Width           =   2535
      End
      Begin VB.CommandButton Command2 
         Caption         =   "转换"
         Height          =   375
         Left            =   2760
         TabIndex        =   25
         Top             =   2880
         Width           =   1215
      End
      Begin VB.TextBox Text10 
         Height          =   1215
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   24
         Top             =   1560
         Width           =   3855
      End
      Begin VB.TextBox Text9 
         Height          =   1215
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   23
         Top             =   240
         Width           =   3855
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   " UNICODE 转换"
      Height          =   3495
      Left            =   6360
      TabIndex        =   15
      Top             =   0
      Width           =   4095
      Begin VB.TextBox Text8 
         Height          =   1335
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   19
         Top             =   2040
         Width           =   3855
      End
      Begin VB.TextBox Text7 
         Height          =   1215
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   17
         Top             =   480
         Width           =   3855
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "字符:"
         Height          =   180
         Index           =   7
         Left            =   120
         TabIndex        =   18
         Top             =   1800
         Width           =   540
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "Unicode 码:"
         Height          =   180
         Index           =   6
         Left            =   120
         TabIndex        =   16
         Top             =   240
         Width           =   1080
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   " PDU 生成"
      Height          =   3495
      Left            =   0
      TabIndex        =   4
      Top             =   0
      Width           =   6255
      Begin 锐方超级SMS控件.SuperSMS SuperSMS1 
         Left            =   240
         Top             =   2760
         _ExtentX        =   900
         _ExtentY        =   900
         SMS_SLen        =   "8"
      End
      Begin VB.CommandButton Command3 
         Caption         =   "FLASH 显示"
         Height          =   375
         Left            =   4920
         TabIndex        =   30
         Top             =   840
         Width           =   1215
      End
      Begin VB.CheckBox Check2 
         Caption         =   "短信回复呼叫"
         Height          =   255
         Left            =   2760
         TabIndex        =   29
         Top             =   910
         Width           =   1455
      End
      Begin VB.CheckBox Check1 
         Caption         =   "短信立即显示"
         Height          =   255
         Left            =   1200
         TabIndex        =   28
         Top             =   910
         Width           =   1455
      End
      Begin VB.TextBox Text6 
         Height          =   1215
         Left            =   1200
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   11
         Top             =   2160
         Width           =   4935
      End
      Begin VB.TextBox Text5 
         Height          =   735
         Left            =   1200
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   10
         Text            =   "Form1.frx":008C
         Top             =   1320
         Width           =   4935
      End
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   4200
         TabIndex        =   8
         Top             =   360
         Width           =   1935
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   1200
         TabIndex        =   5
         Text            =   "13088825236"
         Top             =   360
         Width           =   1935
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "长度:"
         Height          =   180
         Index           =   10
         Left            =   240
         TabIndex        =   31
         Top             =   2400
         Width           =   540
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Height          =   180
         Index           =   9
         Left            =   840
         TabIndex        =   27
         Top             =   2400
         Width           =   90
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "PDU编码:"
         Height          =   180
         Index           =   5
         Left            =   240
         TabIndex        =   14
         Top             =   2160
         Width           =   810
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "短信内容:"
         Height          =   180
         Index           =   2
         Left            =   240
         TabIndex        =   9
         Top             =   840
         Width           =   900
      End
      Begin VB.Label Label 
         Caption         =   $"Form1.frx":009B
         Height          =   420
         Index           =   1
         Left            =   3240
         TabIndex        =   7
         Top             =   360
         Width           =   1020
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "对方号码:"
         Height          =   180
         Index           =   0
         Left            =   240
         TabIndex        =   6
         Top             =   360
         Width           =   900
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   " PDU 解析"
      Height          =   3375
      Left            =   0
      TabIndex        =   0
      Top             =   3600
      Width           =   6255
      Begin VB.ComboBox Combo1 
         Height          =   300
         ItemData        =   "Form1.frx":00B3
         Left            =   3960
         List            =   "Form1.frx":00C0
         Style           =   2  'Dropdown List
         TabIndex        =   20
         Top             =   1605
         Width           =   855
      End
      Begin VB.TextBox Text1 
         Height          =   975
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   3
         Top             =   480
         Width           =   6015
      End
      Begin VB.TextBox Text2 
         Height          =   1215
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   2
         Top             =   2040
         Width           =   6015
      End
      Begin VB.CommandButton Command1 
         Caption         =   "解析"
         Height          =   375
         Left            =   4920
         TabIndex        =   1
         Top             =   1560
         Width           =   1215
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "日期、时间类型:"
         Height          =   180
         Index           =   8
         Left            =   2520
         TabIndex        =   21
         Top             =   1680
         Width           =   1440
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   " PDU 解析后:"
         Height          =   180
         Index           =   4
         Left            =   120
         TabIndex        =   13
         Top             =   1800
         Width           =   1170
      End
      Begin VB.Label Label 
         AutoSize        =   -1  'True
         Caption         =   "完整 PDU 码:"
         Height          =   180
         Index           =   3
         Left            =   120
         TabIndex        =   12
         Top             =   240
         Width           =   1170
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim P As String, D As String, T As String, TXT As String, E As Integer

Private Sub Check1_Click()
If Check1.Value = 0 Then
   SuperSMS1.DisplayNow = False
ElseIf Check1.Value = 1 Then
   SuperSMS1.DisplayNow = True
End If
Conv
End Sub

Private Sub Check2_Click()
If Check2.Value = 0 Then
   SuperSMS1.RevertNow = False
ElseIf Check2.Value = 1 Then
   SuperSMS1.RevertNow = True
End If
Conv
End Sub

Private Sub Command1_Click()
'SuperSMS1.ConPDU 完整的 PDU ,电话号码,日期,时间,内容,日期时间格式,错误码

'日期时间格式有 3 种,分别是0, 1,2
'如果解析失败,在错误码里有提示

'SMSErr 报告错误代码,返回 0 表示正确!
'SMSErr=1 ,PDU 代码错误,可能含有中文字符
'SMSErr=2 ,PDU 代码错误,代码长度不够
'SMSErr=2 ,PDU 代码错误,代码位数必须是偶数
'SMSErr=4 ,PDU 解码错误,此版本不支持 7 bit 解码
'SMSErr=5 ,PDU 用户数据解码错误
'SMSErr=99 ,未知错误

'解析 PDU
SuperSMS1.ConPDU Text1.Text, P, D, T, TXT, Int(Combo1.ListIndex), E

'获得解析后的数据
Text2.Text = "电话号码:" & P & vbCrLf _
& "日期:" & D & vbCrLf _
& "时间:" & T & vbCrLf _
& "内容:" & TXT & vbCrLf _
& "错误代码:" & E

End Sub

Private Sub Command2_Click()
Text10.Text = SuperSMS1.NoConv(Text9.Text, Combo2.ListIndex + 1)
End Sub

Private Sub Command3_Click()
Dim a, b
a = Text5.SelStart
b = Text5.SelLength

If b = 0 Then
   Text5.SelText = ChrW("&H2605")
ElseIf a + b = Len(Text5) Then
   Text5.SelStart = Text5.SelStart
   Text5.SelText = ChrW("&H2605")
Else
   Text5.SelStart = a
   Text5.SelText = ChrW("&H2605")
   Text5.SelStart = a + b + 1
   Text5.SelText = ChrW("&H2605")
End If
End Sub

Private Sub Form_Load()
Combo1.ListIndex = 1
Combo2.ListIndex = 0

'这个是完整的 PDU 代码
Text1.Text = "0891683108200105F0040BA13119577771F50008201130029592200E0041004200430044004500466211"
'这个 UNICODE 码
Text7.Text = "4E2D658777ED4FE16D4B8BD5"
'转换
Conv
End Sub

'转换
Sub Conv()
SuperSMS1.SMS_Phone = Text3.Text
SuperSMS1.SMS_CSCA = Text4.Text
SuperSMS1.SMS_STXT = Text5.Text
Text6.Text = SuperSMS1.SMS_SMain
Text8.Text = SuperSMS1.ANSIText(Text7.Text)
Label(9).Caption = SuperSMS1.SMS_SLen
End Sub

'转换
Private Sub Text3_Change()
Conv
End Sub

'转换
Private Sub Text4_Change()
Conv
End Sub

'转换
Private Sub Text5_Change()
Conv
End Sub

'转换
Private Sub Text7_Change()
Conv
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -