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

📄 testform.frm

📁 南京德托电子科技有限公司的产品手机短信二次开发控件DetuoSmsOcx.ocx的vb实例
💻 FRM
字号:
VERSION 5.00
Object = "{AC31EF70-90E1-43C9-8EC2-D47E6E2146D1}#1.0#0"; "DetuoSmsOcx.ocx"
Begin VB.Form Form1 
   Caption         =   "德托短信二次开发包演示程序"
   ClientHeight    =   7425
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8805
   Icon            =   "testForm.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   7425
   ScaleWidth      =   8805
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame2 
      Caption         =   "发送/接受 短信"
      Height          =   5175
      Left            =   240
      TabIndex        =   5
      Top             =   2040
      Width           =   8415
      Begin VB.CommandButton Command1 
         Caption         =   "关于"
         Height          =   615
         Left            =   6840
         TabIndex        =   18
         Top             =   4440
         Width           =   1335
      End
      Begin VB.CommandButton disLinkModem 
         Caption         =   "断开GSM猫"
         Enabled         =   0   'False
         Height          =   615
         Left            =   5400
         TabIndex        =   15
         Top             =   4440
         Width           =   1455
      End
      Begin VB.CommandButton sendMsg 
         Caption         =   "发送短信"
         Enabled         =   0   'False
         Height          =   615
         Left            =   4080
         TabIndex        =   12
         Top             =   4440
         Width           =   1335
      End
      Begin VB.CommandButton readMsg 
         Caption         =   "读取短信"
         Enabled         =   0   'False
         Height          =   615
         Left            =   2760
         TabIndex        =   11
         Top             =   4440
         Width           =   1335
      End
      Begin VB.CommandButton readCenterNO 
         Caption         =   "读中心号"
         Enabled         =   0   'False
         Height          =   615
         Left            =   1440
         TabIndex        =   17
         Top             =   4440
         Width           =   1335
      End
      Begin VB.TextBox Txt1 
         Height          =   2655
         Left            =   1560
         MultiLine       =   -1  'True
         TabIndex        =   13
         Text            =   "testForm.frx":038A
         Top             =   1440
         Width           =   5655
      End
      Begin VB.CommandButton LinkModem 
         Caption         =   "连接GSM猫"
         Height          =   615
         Left            =   120
         TabIndex        =   10
         Top             =   4440
         Width           =   1335
      End
      Begin VB.TextBox TCenterNO 
         Height          =   375
         Left            =   1560
         TabIndex        =   8
         Text            =   "13010341500"
         Top             =   360
         Width           =   1695
      End
      Begin VB.TextBox TSendPhoneNO 
         Height          =   375
         Left            =   1560
         TabIndex        =   7
         Text            =   "13218079658"
         Top             =   840
         Width           =   1695
      End
      Begin VB.Label Label4 
         Caption         =   "发送/接受消息内容"
         Height          =   375
         Left            =   240
         TabIndex        =   14
         Top             =   1440
         Width           =   975
      End
      Begin VB.Label CenterNO 
         Caption         =   "短信中心号"
         Height          =   255
         Left            =   240
         TabIndex        =   9
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "手机号"
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   840
         Width           =   975
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "串口属性"
      Height          =   1335
      Left            =   240
      TabIndex        =   0
      Top             =   240
      Width           =   8415
      Begin DetuoSmsOCX.Modem Modem1 
         Left            =   4920
         Top             =   600
         _ExtentX        =   794
         _ExtentY        =   794
      End
      Begin VB.ComboBox comRate 
         Height          =   300
         ItemData        =   "testForm.frx":03FD
         Left            =   1080
         List            =   "testForm.frx":040D
         TabIndex        =   4
         Text            =   "9600"
         Top             =   840
         Width           =   1095
      End
      Begin VB.ComboBox comName 
         Height          =   300
         ItemData        =   "testForm.frx":042A
         Left            =   1080
         List            =   "testForm.frx":044C
         TabIndex        =   3
         Text            =   "com1"
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "消息提示:"
         Height          =   375
         Left            =   3240
         TabIndex        =   16
         Top             =   480
         Width           =   3615
      End
      Begin VB.Label Label2 
         Caption         =   "串口"
         Height          =   375
         Left            =   120
         TabIndex        =   2
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "波特率"
         Height          =   375
         Left            =   120
         TabIndex        =   1
         Top             =   840
         Width           =   855
      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()
  Modem1.About
End Sub

Private Sub disLinkModem_Click()
Modem1.DisconModem
  readCenterNO.Enabled = False
  readMsg.Enabled = False
  sendMsg.Enabled = False
  disLinkModem.Enabled = False
  LinkModem.Enabled = True
End Sub

Private Sub Form_Load()
'modem1.
End Sub

Private Sub LinkModem_Click()
 Dim ret As Integer
 ret = Modem1.ConModem(comName.Text, CInt(comRate.Text))
If ret Then
  readCenterNO.Enabled = True
  readMsg.Enabled = True
  sendMsg.Enabled = True
  disLinkModem.Enabled = True
  LinkModem.Enabled = False
    TCenterNO.Text = Modem1.getCenterNO()
Else
  MsgBox "连接MODEM失败", , "提示"
End If
End Sub

Private Sub Modem1_recvMsg(ByVal phoneNO As String, ByVal recvTime As String, ByVal MsgContent As String)
           'Txt1.Text = Form1.Txt1.Text & vbCrLf & "中心号码:" & phoneno
           Txt1.Text = Form1.Txt1.Text & vbCrLf & "发送号码:" & phoneNO
           Txt1.Text = Form1.Txt1.Text & vbCrLf & "发送时间:" & recvTime
           Txt1.Text = Form1.Txt1.Text & vbCrLf & "发送内容:" & MsgContent
            Label6.Caption = "消息提示:收到新消息!!"
End Sub

Private Sub readCenterNO_Click()
 TCenterNO.Text = Modem1.getCenterNO()
 MsgBox Modem1.getCenterNO, , "GSM CENTER NO"
 End Sub

Private Sub readMsg_Click()
 Modem1.readMsg (4)
  
End Sub

Private Sub sendMsg_Click()
Dim ret As Boolean

sendMsg.Enabled = False
ret = Modem1.sendMsg(TSendPhoneNO, Txt1.Text)
If ret Then
 Label6.Caption = "消息提示:发送成功"
 Else
 Label6.Caption = "消息提示:发送失败"
End If

sendMsg.Enabled = True
End Sub

Private Sub Timer1_Timer()
Label7.Caption = CInt(Label7.Caption) + 1
End Sub

Private Sub Txt1_Change()
   Label6.Caption = "消息提示:正在编辑短消息!!" & Len(Txt1.Text)
End Sub

⌨️ 快捷键说明

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