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

📄 sms_database.frm

📁 VB做的一个短信收发的例子,功能比较强大,可以好好参考
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Object = "{FFE1BB90-AC55-484B-AD43-C91CCF80C439}#4.0#0"; "sms.ocx"
Begin VB.Form SMS_database 
   Caption         =   "短消息发送软件"
   ClientHeight    =   6435
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   12165
   LinkTopic       =   "Form1"
   ScaleHeight     =   6435
   ScaleWidth      =   12165
   StartUpPosition =   2  'CenterScreen
   Begin SMSocx.SMS SMS1 
      Left            =   315
      Top             =   1530
      _ExtentX        =   1720
      _ExtentY        =   1270
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      InputLen        =   1
      RThreshold      =   1
      Settings        =   "115200,n,8,1"
      RTSEnable       =   -1  'True
      LastUpdate      =   ""
      RetryTimes      =   1
      SMSStorage      =   "MT"
   End
   Begin VB.Frame Frame1 
      Caption         =   "发送短消息"
      Height          =   5925
      Left            =   105
      TabIndex        =   0
      Top             =   15
      Width           =   4425
      Begin VB.CommandButton Command6 
         Caption         =   "缓冲区中短信"
         Height          =   360
         Left            =   105
         TabIndex        =   22
         Top             =   3300
         Width           =   990
      End
      Begin VB.CommandButton CmdSendToUs 
         Caption         =   "Email"
         Height          =   285
         Left            =   3405
         TabIndex        =   21
         Top             =   5025
         Width           =   915
      End
      Begin VB.TextBox TxtReq 
         Height          =   285
         Left            =   825
         TabIndex        =   20
         Top             =   5430
         Width           =   2565
      End
      Begin VB.TextBox TxtID 
         BackColor       =   &H00FFFFFF&
         Height          =   285
         Left            =   810
         TabIndex        =   17
         Text            =   "产品序号:"
         Top             =   5010
         Width           =   2580
      End
      Begin VB.Timer Timer1 
         Interval        =   1000
         Left            =   195
         Top             =   2475
      End
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "MS Serif"
            Size            =   6
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   1185
         Left            =   810
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   2
         Top             =   3765
         Width           =   3525
      End
      Begin VB.TextBox TxtNum 
         Height          =   330
         Left            =   840
         TabIndex        =   5
         Text            =   "13391028127"
         Top             =   450
         Width           =   3390
      End
      Begin VB.TextBox TxtNr 
         Height          =   2340
         Left            =   825
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   4
         Text            =   "SMS_database.frx":0000
         Top             =   870
         Width           =   3420
      End
      Begin VB.CommandButton Command2 
         Caption         =   "发送"
         Height          =   420
         Left            =   2400
         TabIndex        =   3
         Top             =   3285
         Width           =   1215
      End
      Begin VB.CommandButton Command1 
         Caption         =   "已发送短消息"
         Height          =   420
         Left            =   1110
         TabIndex        =   1
         Top             =   3285
         Width           =   1230
      End
      Begin VB.Label Label8 
         Caption         =   "确认号:"
         Height          =   285
         Left            =   150
         TabIndex        =   19
         Top             =   5490
         Width           =   780
      End
      Begin VB.Label Label7 
         Caption         =   "ID:"
         Height          =   210
         Left            =   165
         TabIndex        =   18
         Top             =   5025
         Width           =   525
      End
      Begin VB.Label Label6 
         Caption         =   "多个号码之间可以用分割。"
         Height          =   240
         Left            =   900
         TabIndex        =   12
         Top             =   195
         Width           =   2550
      End
      Begin VB.Label Label1 
         Caption         =   "号码"
         Height          =   285
         Left            =   210
         TabIndex        =   8
         Top             =   450
         Width           =   1230
      End
      Begin VB.Label Label2 
         Caption         =   "内容"
         Height          =   240
         Left            =   195
         TabIndex        =   7
         Top             =   1185
         Width           =   990
      End
      Begin VB.Label Label3 
         Caption         =   "状态:"
         Height          =   255
         Left            =   150
         TabIndex        =   6
         Top             =   4005
         Width           =   990
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "接收的短消息"
      Height          =   5925
      Left            =   4680
      TabIndex        =   9
      Top             =   0
      Width           =   7395
      Begin VB.CommandButton Command3 
         Caption         =   "上一页"
         Height          =   390
         Left            =   1110
         TabIndex        =   15
         Top             =   5460
         Width           =   885
      End
      Begin VB.CommandButton Command4 
         Caption         =   "下一页"
         Height          =   375
         Left            =   2205
         TabIndex        =   14
         Top             =   5460
         Width           =   900
      End
      Begin VB.CommandButton Command5 
         Caption         =   "结束"
         Height          =   360
         Left            =   4845
         TabIndex        =   13
         Top             =   5445
         Width           =   840
      End
      Begin MSFlexGridLib.MSFlexGrid MSGrid1 
         Height          =   5235
         Left            =   120
         TabIndex        =   10
         Top             =   240
         Width           =   7005
         _ExtentX        =   12356
         _ExtentY        =   9234
         _Version        =   393216
         Rows            =   21
         Cols            =   4
         FixedCols       =   0
         FormatString    =   "  序  号  |       号               码              |               内                            容  |     时              间"
      End
      Begin VB.Label Label4 
         Caption         =   "当前为第1页"
         Height          =   285
         Left            =   3360
         TabIndex        =   16
         Top             =   5505
         Width           =   1080
      End
   End
   Begin VB.Label Label5 
      ForeColor       =   &H00FF0000&
      Height          =   345
      Left            =   525
      MouseIcon       =   "SMS_database.frx":0009
      MousePointer    =   99  'Custom
      TabIndex        =   11
      Top             =   6045
      Width           =   3630
   End
End
Attribute VB_Name = "SMS_database"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'您需要进行以下几步。
'初始化
'发送短消息
'发送完成事件和接收短消息事件
'结束

' sms_state  0 未发,1 发送中,2 已发送,3 已送达
Dim Rd As Recordset
Private Type SMStype
'短消息结构
  CSCA As String
  SmsFrom As String
  SmsTo As String
  smsNR As String
  SMStime As String
  sID As String
  sReportID As String
  sReportState As String
End Type

Dim CURpage As Integer

Dim SMSrecv As SMStype

Dim iRegState As Integer '错误状态次数

Private Sub CmdSendToUs_Click()
'你可以直接从这里给我们的产品编号。

'SMS1.SendSMSWithoutRet "13391028128", TxtID.Text, 0
ShellExecute Me.hwnd, vbNullString, "mailto:dlxw@china.com?subject=" & TxtID.Text, vbNullString, vbNullString, 1

End Sub

Private Sub Command1_Click()
Dialog.Show vbModal
End Sub

Private Sub Command2_Click()
'发送短消息

Dim lID As Long
Dim s
If InStr(TxtNum.Text, ",") > 0 Then
s = Split(TxtNum.Text, ",")
For i = 0 To UBound(s)
    If s(0) <> "" Then
    sql = "insert into smssend (sms_num,sms_nr,SMS_state) values('" & s(i) & "','" & Left(Replace(TxtNr.Text, "'", ""), 70) & "','0')"
    conn.Errors.Clear
    conn.Execute sql
    End If

Next

Else

conn.Errors.Clear
conn.Execute ("insert into smssend (sms_num,sms_nr,SMS_state) values('" & TxtNum.Text & "','" & Left(Replace(TxtNr.Text, "'", ""), 70) & "','0')")

End If


If conn.Errors.Count > 0 Then
  MsgBox "保存数据时出错。"
  Else
  Debug.Print "保存ok"
 
End If
End Sub

Private Sub Command3_Click()
 CURpage = listInGrid(CURpage - 1)
 Label4.Caption = "当前为第" & CURpage & "页"
End Sub

Private Sub Command4_Click()
 CURpage = listInGrid(CURpage + 1)
 Label4.Caption = "当前为第" & CURpage & "页"
End Sub

Private Sub Command5_Click()
Unload Me
End Sub

Private Sub Command6_Click()
MsgBox SMS1.NotSendSMSCount & "条尚未发送。"
End Sub

Private Sub Form_Load()
On Error GoTo err1
 Dim ret
 '初始化端口  '
 

⌨️ 快捷键说明

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