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

📄 form1.frm

📁 COM短信猫开发源码
💻 FRM
字号:
VERSION 5.00
Object = "*\A工程1.vbp"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7050
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   9960
   LinkTopic       =   "Form1"
   ScaleHeight     =   7050
   ScaleWidth      =   9960
   StartUpPosition =   3  '窗口缺省
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   6960
      Top             =   960
   End
   Begin VB.TextBox txtSim 
      Height          =   375
      Left            =   600
      TabIndex        =   7
      Text            =   "13299122226"
      Top             =   120
      Visible         =   0   'False
      Width           =   1335
   End
   Begin VB.TextBox Rcv 
      ForeColor       =   &H00008000&
      Height          =   2415
      Left            =   240
      MultiLine       =   -1  'True
      TabIndex        =   6
      Top             =   4560
      Width           =   9255
   End
   Begin VB.TextBox Log 
      ForeColor       =   &H00800000&
      Height          =   2655
      Left            =   240
      MultiLine       =   -1  'True
      TabIndex        =   5
      Top             =   1560
      Width           =   9255
   End
   Begin VB.CommandButton Command3 
      Caption         =   "发送"
      Enabled         =   0   'False
      Height          =   375
      Left            =   8520
      TabIndex        =   4
      Top             =   120
      Visible         =   0   'False
      Width           =   735
   End
   Begin VB.TextBox txtSend 
      Height          =   375
      Left            =   2640
      TabIndex        =   3
      Text            =   "测试短信"
      Top             =   120
      Visible         =   0   'False
      Width           =   5655
   End
   Begin VB.CommandButton Command2 
      Caption         =   "关闭"
      Enabled         =   0   'False
      Height          =   615
      Left            =   1560
      TabIndex        =   2
      Top             =   720
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "初始化"
      Height          =   615
      Left            =   120
      TabIndex        =   1
      Top             =   720
      Width           =   1215
   End
   Begin 工程1.Sms Sms1 
      Height          =   735
      Left            =   960
      TabIndex        =   0
      Top             =   360
      Visible         =   0   'False
      Width           =   855
      _ExtentX        =   1508
      _ExtentY        =   1296
   End
   Begin VB.Label Label2 
      Caption         =   "内容"
      Height          =   255
      Left            =   2160
      TabIndex        =   9
      Top             =   240
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "电话"
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   240
      Visible         =   0   'False
      Width           =   375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

Dim id As Integer


Private Sub Command1_Click()
Command3.Enabled = True
Command2.Enabled = True
Command1.Enabled = False
End Sub

Private Sub Command2_Click()
Sms1.CloseSms
Command3.Enabled = False
Command1.Enabled = True
Command2.Enabled = False

End Sub


Private Sub Command3_Click()
Sms1.Send txtSim.Text, txtSend.Text
End Sub

Private Sub Form_Load()
On Error GoTo ErrHandle
Dim strCnn As String
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=sms.mdb;Persist Security Info=False"
cn.Open strCnn
Sms1.Com = 6
Sms1.BaudRate = 115200
'Sms1.Csca = "13800290500" '短信中心号码1`
Sms1.Csca = "13010851500" '短信中心号码2
If Sms1.Ini() = False Then GoTo ErrHandle

Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = True
Timer1.Enabled = True
Exit Sub
ErrHandle:
Command1.Enabled = False
End Sub


Private Sub Sms1_OnRcvSms(ByVal Msg As String, ByVal sim As String, ByVal Time As String)
Rcv.Text = Rcv.Text & Time & "收到" & sim & "短信:" & sim
End Sub

Private Sub Sms1_OnSendResult(ByVal sim As String, ByVal Msg As String, ByVal SendFlag As Boolean)
Log.Text = Log.Text & "发送到" & sim & "的短信(" & Msg & ")" & IIf(SendFlag, "成功", "失败") & vbCr
'If SendFlag = True Then
'    cn.Execute "update sms set addstate = 2 where id= " & Str(id)
'
'Else
'    cn.Execute "update sms set addstate = 3 where id= " & Str(id)
'
'End If
'id = 0
Timer1.Enabled = True

End Sub

Private Sub Timer1_Timer()
'rs.Open "select id ,Addvalue,AddSim from sms where addstate = 0", cn, adOpenStatic, adLockReadOnly, adCmdText
'Dim sim As String
'Dim value As Integer
'If rs.RecordCount > 0 Then
'    id = rs("id").value
'    sim = rs("addsim").value
'    value = rs("addvalue").value
'    'Sms1.Send "10655820", "jf " & sim & " " & Str(value) & " 0000"
    Sms1.Send "10655820", "ye"
    Timer1.Enabled = False
'    cn.Execute "update sms set addstate = 1 where id= " & Str(id)
'End If
'    rs.Close
'    Set rs = Nothing
End Sub

⌨️ 快捷键说明

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