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

📄 form1.frm

📁 用于在串口上开发手机短信的工具包
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "DEMO_v3"
   ClientHeight    =   4755
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6795
   LinkTopic       =   "Form1"
   ScaleHeight     =   4755
   ScaleWidth      =   6795
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command6 
      Caption         =   "Command6"
      Enabled         =   0   'False
      Height          =   495
      Left            =   4320
      TabIndex        =   14
      Top             =   3120
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "接收短信"
      Height          =   495
      Left            =   4560
      TabIndex        =   13
      Top             =   3720
      Width           =   1935
   End
   Begin VB.TextBox Text6 
      Height          =   855
      Left            =   600
      TabIndex        =   12
      Top             =   3480
      Width           =   2895
   End
   Begin VB.CommandButton Command5 
      Caption         =   "始初化"
      Height          =   615
      Left            =   4440
      TabIndex        =   11
      Top             =   960
      Width           =   2175
   End
   Begin VB.TextBox Text5 
      Enabled         =   0   'False
      Height          =   285
      Left            =   2640
      TabIndex        =   10
      Top             =   720
      Width           =   1575
   End
   Begin VB.TextBox Text4 
      Enabled         =   0   'False
      Height          =   315
      Left            =   2640
      TabIndex        =   9
      Top             =   240
      Width           =   1575
   End
   Begin VB.CommandButton Command4 
      Caption         =   "关闭串口"
      Height          =   375
      Left            =   4440
      TabIndex        =   8
      Top             =   2640
      Width           =   2175
   End
   Begin VB.CommandButton Command3 
      Caption         =   "打开串口"
      Height          =   375
      Left            =   4440
      TabIndex        =   7
      Top             =   240
      Width           =   2175
   End
   Begin VB.TextBox Text3 
      Height          =   375
      Left            =   1440
      TabIndex        =   6
      Text            =   "COM4"
      Top             =   240
      Width           =   855
   End
   Begin VB.TextBox Text2 
      Height          =   405
      Left            =   600
      MaxLength       =   16
      TabIndex        =   2
      Text            =   "手机号"
      Top             =   2640
      Width           =   3135
   End
   Begin VB.CommandButton Command1 
      Caption         =   "发送"
      Height          =   495
      Left            =   4440
      TabIndex        =   1
      Top             =   1800
      Width           =   2175
   End
   Begin VB.TextBox Text1 
      Height          =   645
      Left            =   600
      MultiLine       =   -1  'True
      TabIndex        =   0
      Text            =   "Form1.frx":0000
      Top             =   1320
      Width           =   3615
   End
   Begin VB.Label Label3 
      Caption         =   "串口"
      Height          =   255
      Left            =   600
      TabIndex        =   5
      Top             =   240
      Width           =   495
   End
   Begin VB.Label Label2 
      Caption         =   "请输入手机号 "
      Height          =   255
      Left            =   600
      TabIndex        =   4
      Top             =   2160
      Width           =   1695
   End
   Begin VB.Label Label1 
      Caption         =   "请输入短信内容(70汉字)"
      Height          =   255
      Left            =   600
      TabIndex        =   3
      Top             =   840
      Width           =   1935
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim com_inf As STRUCommInfo
Public ophandle As Long
Dim RSms As SM_RCV_STRU
Dim rr As SM
Dim nationality_cord As Integer





Private Sub Command1_Click()
nationality_cord = 0
Dim errmsg_send As String
Dim PhNbr As String

Dim Msg_tmp1 As String
Dim nMsg_tmp2 As String
errmsg_send = "1234"
Msg_tmp1 = Text1.Text
nMsg_tmp2 = "11kdskdikdddd"
PhNbr = Text2.Text
send = bSendMsg(ophandle, Msg_tmp1, PhNbr, Trim(com_inf.szSCA), nationality_cord, nMsg_tmp2, errmsg_send)

'字符串不能为空

End Sub

Private Sub Command2_Click()
nationality_cord = 0
        Dim err_r As String
        err_r = "1234"
        rev = iRecvMsg(ophandle, RSms, nationality_cord, err_r)
         Text6.Text = RSms.iSmsTotal
        For i = 0 To 50
        Text6.Text = Text6.Text + Trim(RSms.SMS(i).TP_UD)
        Next
        Text6.Text = Text6.Text + Trim(RSms.SMS(0).TPA)
End Sub

Private Sub Command3_Click()
nationality_cord = 0
Dim strtmp As String
strtmp = Text3.Text
ophandle = hOpenComm(strtmp)
If ophandle > 0 Then
Text4.Text = "打开COM口成功"
Else
Text4.Text = "打开COM口失败"
End If

End Sub

Private Sub Command4_Click()
nationality_cord = 0
    close_com = bCloseComm(ophandle)
    If close_com = True Then
    Text5.Text = "关闭COM口成功"
    Else
    Text5.Text = "关闭COM口失败"
    End If
End Sub

Private Sub Command5_Click()
nationality_cord = 0
Dim errmsg As String
errmsg = "123"
com_inf.iBaudRate = 9600
scat = bAutoInit(ophandle, com_inf, nationality_cord, errmsg)
Text5.Text = scat

End Sub

Private Sub Command6_Click()
nationality_cord = 0
aa = RM(123, rr, "aaaa")
yy = rr.TP_UD
Text6.Text = Trim(yy)
End Sub

Private Sub Form_Load()
        nationality_cord = 0
    Dim regedit_ver As Long
    Dim ver(1) As String * 100
    ver(0) = "1"
    
    GetVerInfo (ver(0))
    Dim str_ver As String
    str_ver = ver(0)
    str_ver = Trim(str_ver)
    Text5.Text = str_ver
    regedit_ver = iSetSerialNo("北京方环电子公司", "注册码")
    For i = 0 To 50
    RSms.SMS(i).SCA = " "
    RSms.SMS(i).TP_SCTS = " "
    RSms.SMS(i).TP_UD = " "
    RSms.SMS(i).TPA = " "

    Next
     
    

End Sub

Private Sub Form_Unload(Cancel As Integer)
Command4_Click
End Sub

⌨️ 快捷键说明

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