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

📄 frmsent.frm

📁 手机短心控制接收发射程序,通过串口与手机连接,
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmSent 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "发送短信"
   ClientHeight    =   4860
   ClientLeft      =   45
   ClientTop       =   615
   ClientWidth     =   7155
   Icon            =   "frmSent.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4860
   ScaleWidth      =   7155
   StartUpPosition =   2  '屏幕中心
   Tag             =   "1"
   Begin VB.Frame Frame3 
      BorderStyle     =   0  'None
      Height          =   375
      Left            =   1200
      TabIndex        =   10
      Top             =   0
      Width           =   3615
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         ForeColor       =   &H00808080&
         Height          =   180
         Left            =   960
         TabIndex        =   12
         Top             =   120
         Width           =   90
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "手机序号:"
         ForeColor       =   &H00808080&
         Height          =   180
         Left            =   120
         TabIndex        =   11
         Top             =   120
         Width           =   810
      End
   End
   Begin VB.CommandButton Command3 
      Caption         =   "输入(&I)"
      Height          =   375
      Left            =   4920
      TabIndex        =   9
      ToolTipText     =   "输入电话号码"
      Top             =   0
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "保存(&B)"
      Height          =   375
      Left            =   6000
      TabIndex        =   8
      ToolTipText     =   "内容存入手机,不发送"
      Top             =   0
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "插入常用短信(&I)"
      Height          =   495
      Left            =   3600
      TabIndex        =   6
      Top             =   4320
      Width           =   1695
   End
   Begin VB.CommandButton cmdSent 
      Caption         =   "发送(&S)"
      Height          =   495
      Left            =   5640
      TabIndex        =   5
      Top             =   4320
      Width           =   1095
   End
   Begin VB.Frame Frame2 
      Caption         =   "短信内容[0/190]"
      Height          =   3495
      Left            =   3480
      TabIndex        =   3
      Top             =   600
      Width           =   3375
      Begin VB.TextBox txtSms 
         Height          =   3135
         Left            =   120
         MaxLength       =   190
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   4
         Top             =   240
         Width           =   3135
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "电话号码"
      Height          =   3975
      Left            =   360
      TabIndex        =   1
      Top             =   600
      Width           =   3015
      Begin VB.Timer Timer2 
         Enabled         =   0   'False
         Interval        =   500
         Left            =   840
         Top             =   2160
      End
      Begin VB.Timer Timer1 
         Enabled         =   0   'False
         Interval        =   1000
         Left            =   1920
         Top             =   2640
      End
      Begin VB.ListBox lstTel 
         BeginProperty Font 
            Name            =   "System"
            Size            =   12
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   3180
         Left            =   120
         TabIndex        =   2
         ToolTipText     =   "按""Delete""键删除,按""Insert""键添加"
         Top             =   240
         Width           =   2775
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   7
         Top             =   3480
         Width           =   2775
      End
   End
   Begin MSComctlLib.TabStrip TabStrip1 
      Height          =   4935
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6975
      _ExtentX        =   12303
      _ExtentY        =   8705
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   1
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "短信发送"
            ImageVarType    =   2
         EndProperty
      EndProperty
   End
   Begin VB.Menu pmlist 
      Caption         =   "pmList"
      Begin VB.Menu pList 
         Caption         =   "增加电话"
         Index           =   1
      End
      Begin VB.Menu pList 
         Caption         =   "删除电话"
         Index           =   2
      End
   End
   Begin VB.Menu pmText 
      Caption         =   "pmText"
      Begin VB.Menu pText 
         Caption         =   "拖入常用短信"
         Index           =   1
      End
   End
End
Attribute VB_Name = "frmSent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim dSelTel As Recordset
Dim telCount As Integer
Dim mt720Sn As String
Dim txtLength As String


Private Sub cmdSent_Click()
On Error Resume Next
    Dim i As Integer
    Dim txtTmp As String
    Dim txtTmp1 As String
    SentB = True
    For i = 0 To Me.lstTel.ListCount - 1
        txtTmp = txtTmp & lstTel.List(i) & ","
    Next i
    
    If txtTmp = "" Then
        MsgBox "请选择电话号码,以便发送短信!", 16, "提示"
        Exit Sub
    End If
    
    txtTmp = Left(txtTmp, Len(txtTmp) - 1)
    
    txtTmp1 = ascConvert(Me.txtSms.Text)
    If txtTmp1 = "" Then
        MsgBox "请输入发送短信的内容!", 16, "提示"
        Exit Sub
    End If
    
    Call frmMain.rs232("SaveSms", 12, , , txtTmp, txtTmp1)
    Load frmSentInfo
    frmSentInfo.Show 1
End Sub

Private Sub Command2_Click()
On Error Resume Next
    Dim i As Integer
    Dim txtTmp As String
    Dim txtTmp1 As String
    SentB = False
    For i = 0 To Me.lstTel.ListCount - 1
        txtTmp = txtTmp & lstTel.List(i) & ","
    Next i
    
    If txtTmp = "" Then
        MsgBox "请选择电话号码,以便发送短信!", 16, "提示"
        Exit Sub
    End If
    
    txtTmp = Left(txtTmp, Len(txtTmp) - 1)
    
    txtTmp1 = ascConvert(Me.txtSms.Text)
    If txtTmp1 = "" Then
        MsgBox "请输入发送短信的内容!", 16, "提示"
        Exit Sub
    End If
    
    Call frmMain.rs232("SaveSms", 12, , , txtTmp, txtTmp1)
    Load frmSentInfo
    frmSentInfo.Show 1
End Sub

Private Sub Command3_Click()
    Dim strTmp As String
    strTmp = InputBox("输入电话号码", "增加")
    If strTmp <> "" Then lstTel.AddItem strTmp
End Sub

Private Sub Form_Load()
'On Error Resume Next
    Dim pSn As String
    Dim txtTmp As String
    frmSentB = True
    'Timer1.Enabled = True              'changed 2005/12
    'txtTmp = Dir(App.Path & "\pSn.dat")
    'If txtTmp = "pSn.dat" Then
    '    Open App.Path & "\pSn.dat" For Binary As #1
    '        Get #1, 1, pSn
    '    Close #1
    'End If
    txtLength = 10
    'mt720Sn = GetSetting(App.EXEName, "注册", "手机SN", "0")       'changed 2005/12
    Set dSelTel = myDb.OpenRecordset("select * from phonebook", dbOpenDynaset)
    Me.pmlist.Visible = False
    Me.pmText.Visible = False
End Sub



Private Sub Label1_Change()
    Label1.ToolTipText = Label1.Caption
End Sub

Private Sub lstTel_Click()
On Error Resume Next
    Set dSelTel = myDb.OpenRecordset("select * from phonebook where telnum like'" & Me.lstTel.Text & "*'", dbOpenDynaset)
    If DataRec(dSelTel, "name") <> "" Then
        Label1.Caption = DataRec(dSelTel, "name")
    Else
        Set dSelTel = myDb.OpenRecordset("select * from phonebook where telnum like'" & delPrefix(Me.lstTel.Text) & "*'", dbOpenDynaset)
        If DataRec(dSelTel, "name") = "" Then
            Label1.Caption = "未知"
        Else
             Label1.Caption = DataRec(dSelTel, "name")
        End If
    End If
End Sub

Private Sub lstTel_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
    Dim i As Integer
    Dim kValue As Integer
    kValue = KeyCode
    If kValue = 46 Then
        i = Me.lstTel.ListIndex
        Me.lstTel.RemoveItem (i)
        If lstTel.ListCount > i Then
                lstTel.Selected(i) = True
            Else
                lstTel.Selected(lstTel.ListCount - 1) = True
        End If
    End If
    If kValue = 45 Then
        Load frmSearchTel
        frmSearchTel.Show 1
    End If
End Sub

Private Sub lstTel_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 2 Then
        Me.PopupMenu pmlist
    End If
End Sub

Private Sub pList_Click(Index As Integer)
On Error Resume Next
    Select Case Index
        Case 1
            Load frmSearchTel
            frmSearchTel.Show 1
        Case 2
            Me.lstTel.RemoveItem (Me.lstTel.ListIndex)
    End Select
End Sub

Private Sub Timer1_Timer()
    Dim mtSerial As String
    DoEvents
    If frmSentB = False Then
        Exit Sub
        Unload Me
    End If
    Call frmMain.rs232("序列号", 16)
    PauseWait (100)

    If Len(Me.Label2.Caption) > 10 Then
        mtSerial = operationSN(Label2.Caption)
        Timer1.Enabled = False
        cmdSent.Enabled = True
        Command2.Enabled = True
        Command3.Enabled = True
        If mt720Sn = mtSerial Then
            Me.txtSms.MaxLength = 190
            Me.Frame2.Caption = "短信内容[0/190]"
            txtLength = 190
        Else
            Me.txtSms.MaxLength = 10
            Me.Frame2.Caption = "短信内容[0/10]"
            Me.Caption = "未注册只能发10个字的短信!"
            Timer2.Enabled = True
            txtLength = 10
        End If
    End If
End Sub

Private Sub Timer2_Timer()
    If Me.Caption = "未注册只能发10个字的短信!" Then
        Me.Caption = "发送短信"
    Else
        Me.Caption = "未注册只能发10个字的短信!"
    End If
End Sub

Private Sub txtSms_Change()
    Me.Frame2.Caption = "短信内容[" & Len(txtSms) & "]" ' & "/" & txtLength & "]" changed 2005/12
    If Len(txtSms) > 70 Then
        txtSms.ForeColor = vbRed
    Else
        txtSms.ForeColor = vbBlack
    End If
End Sub

⌨️ 快捷键说明

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