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

📄 form1.frm

📁 为了对短消息信息应用开发商提供支持
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "企业短信二次开发接口Demo"
   ClientHeight    =   6960
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9930
   LinkTopic       =   "Form1"
   ScaleHeight     =   6960
   ScaleWidth      =   9930
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command4 
      Caption         =   "取剩余短信量"
      Height          =   540
      Left            =   5280
      TabIndex        =   21
      Top             =   3960
      Width           =   1695
   End
   Begin VB.TextBox Text10 
      Height          =   375
      Left            =   1440
      TabIndex        =   20
      Top             =   6480
      Width           =   4215
   End
   Begin VB.TextBox Text9 
      Height          =   375
      Left            =   1440
      TabIndex        =   19
      Top             =   5880
      Width           =   4215
   End
   Begin VB.TextBox Text8 
      Height          =   375
      Left            =   1440
      TabIndex        =   18
      Top             =   5280
      Width           =   4215
   End
   Begin VB.TextBox Text6 
      Height          =   495
      Left            =   1440
      TabIndex        =   16
      Top             =   4680
      Width           =   4215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "取接收到的短信"
      Height          =   540
      Left            =   1200
      TabIndex        =   15
      Top             =   3960
      Width           =   2415
   End
   Begin VB.Frame Frame2 
      Caption         =   "短信发送"
      Height          =   3375
      Left            =   3600
      TabIndex        =   1
      Top             =   240
      Width           =   3495
      Begin VB.CommandButton Command5 
         Caption         =   "SendEx"
         Height          =   495
         Left            =   2280
         TabIndex        =   22
         Top             =   2640
         Width           =   1095
      End
      Begin VB.TextBox Text7 
         Height          =   1695
         Left            =   840
         TabIndex        =   17
         Top             =   840
         Width           =   2415
      End
      Begin VB.CommandButton Command1 
         Caption         =   "发送"
         Height          =   495
         Left            =   840
         TabIndex        =   3
         Top             =   2640
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   840
         TabIndex        =   2
         Top             =   240
         Width           =   2415
      End
      Begin VB.Label Label3 
         Caption         =   "内容"
         Height          =   375
         Left            =   120
         TabIndex        =   7
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label2 
         Caption         =   "手机"
         Height          =   375
         Left            =   120
         TabIndex        =   6
         Top             =   240
         Width           =   495
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "连接设置"
      Height          =   3375
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   3255
      Begin VB.TextBox Text5 
         Height          =   375
         IMEMode         =   3  'DISABLE
         Left            =   720
         PasswordChar    =   "*"
         TabIndex        =   14
         Top             =   1680
         Width           =   2295
      End
      Begin VB.TextBox Text4 
         Height          =   375
         Left            =   720
         TabIndex        =   13
         Top             =   1200
         Width           =   2295
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   720
         TabIndex        =   12
         Text            =   "100000"
         Top             =   720
         Width           =   2295
      End
      Begin VB.TextBox Text2 
         Height          =   375
         Left            =   720
         TabIndex        =   11
         Text            =   "www.mobset.com"
         Top             =   240
         Width           =   2295
      End
      Begin VB.CommandButton Command2 
         Caption         =   "连接"
         Height          =   495
         Left            =   840
         TabIndex        =   4
         Top             =   2640
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "密码"
         Height          =   375
         Left            =   120
         TabIndex        =   10
         Top             =   1800
         Width           =   495
      End
      Begin VB.Label Label5 
         Caption         =   "帐号"
         Height          =   255
         Left            =   120
         TabIndex        =   9
         Top             =   1320
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "企业ID"
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   840
         Width           =   615
      End
      Begin VB.Label Label1 
         Caption         =   "服务器"
         Height          =   375
         Left            =   120
         TabIndex        =   5
         Top             =   360
         Width           =   615
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim b As Long
Dim a As Long
Dim s As String
a = Sms_Send(Trim(Text1.Text), Trim(Text7.Text), VarPtr(b))
  If a >= 0 Then
     Text6.Text = "发送成功,短信ID号是:" & b
  End If
  If a = -1 Then Text6.Text = "连接服务器失败"
  If a = -2 Then Text6.Text = "连接服务器超时"
End Sub

Private Sub Command2_Click()
    Dim a As Long
    
      If Trim(Command2.Caption) = "连接" Then
    a = Sms_Connect(Trim(Text2.Text), Trim(Text3.Text), Trim(Text4.Text), Trim(Text5.Text), 100, 0)
    If a = 0 Then
      Text6.Text = "连接成功"
      Command2.Caption = "断开"
    End If
    If a = -1 Then Text6.Text = "连接服务器失败"
    If a = -2 Then Text6.Text = "连接服务器超时"
    If a = -3 Then Text6.Text = "登录失败,帐号有误"
  Else
    Sms_DisConnect
     Command2.Caption = "连接"
  End If
End Sub

Private Sub Command3_Click()
    Dim szNo   As String
    Dim szMsg  As String
    Dim szTime As String
    Dim aa As Long
   szNo = "                                                "
   szMsg = "                                                                                                                                        "
   szTime = "                                              "
   aa = Sms_Get(szNo, szMsg, szTime)
   If aa >= 0 Then
    Text8.Text = "发送者号码:" & Trim(szNo)
    Text9.Text = "发送时间:" & Trim(szMsg)
    Text10.Text = "发送内容:" & Trim(szTime)
    End If
  If aa = -1 Then Text6.Text = "取短信失败"
End Sub

Private Sub Command4_Click()
Dim a As Long
a = Sms_KYSms()
  If a >= 0 Then
     Text6.Text = "剩余短信量为:" & a
  End If
  If a = -1 Then Text6.Text = "接口未初始化"
  If a = -2 Then Text6.Text = "等数据返回超时"
End Sub

Private Sub Command5_Click()
Dim b As Long
Dim a As Long
Dim s As String
Dim send(2) As SMSSEND

Dim mobile As String
Dim Msg    As String
Dim x()    As Byte

'目标号码与内容
mobile = Trim(Text1.Text)
Msg = Trim(Text7.Text)
'转换目标号码
x = StrConv(mobile, vbFromUnicode)
For i = 1 To LenB(StrConv(mobile, vbFromUnicode))
    send(0).szMobile(i) = x(i - 1)
Next
'转换内容
x = StrConv(Msg, vbFromUnicode)
For i = 1 To LenB(StrConv(Msg, vbFromUnicode))
    send(0).szMsg(i) = x(i - 1)
Next

send(1) = send(0)  '因为是演示,数组2与数组1相同

a = Sms_SendEx(send(0), 2, 1)
If a >= 0 Then
   Text6.Text = "发送成功,短信ID号是:" & send(0).lSmsID
End If
If a = -1 Then Text6.Text = "连接服务器失败"
If a = -2 Then Text6.Text = "连接服务器超时"
End Sub



⌨️ 快捷键说明

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