gprs.frm
资源名称:1.rar [点击查看]
上传用户:wzjlab
上传日期:2022-05-28
资源大小:286k
文件大小:30k
源码类别:
手机短信编程
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
- Begin VB.Form Form1
- BorderStyle = 0 'None
- Caption = "Form1"
- ClientHeight = 8025
- ClientLeft = 0
- ClientTop = 0
- ClientWidth = 10830
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- LinkTopic = "Form1"
- LockControls = -1 'True
- ScaleHeight = 8025
- ScaleWidth = 10830
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 '屏幕中心
- Begin VB.CommandButton Command28
- Caption = "删全部信息"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4320
- TabIndex = 40
- Top = 7560
- Width = 1095
- End
- Begin VB.CommandButton Command27
- Caption = "读全部信息"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 8280
- TabIndex = 39
- Top = 7560
- Width = 1455
- End
- Begin VB.CommandButton Command26
- Caption = "删第"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 10200
- TabIndex = 38
- Top = 6840
- Width = 375
- End
- Begin VB.CommandButton Command25
- Caption = "读第"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 8880
- TabIndex = 36
- Top = 6840
- Width = 375
- End
- Begin VB.TextBox datindex
- Height = 300
- Left = 9360
- TabIndex = 35
- Text = "1"
- Top = 6960
- Width = 480
- End
- Begin VB.CommandButton Command24
- Caption = "发短息"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7680
- TabIndex = 34
- Top = 6960
- Width = 975
- End
- Begin VB.TextBox hao
- Height = 375
- Left = 2280
- TabIndex = 32
- Text = "15161500377"
- Top = 240
- Width = 1335
- End
- Begin VB.CommandButton Command23
- Caption = "本机号码"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 31
- Top = 6480
- Width = 2895
- End
- Begin VB.CommandButton Command22
- Caption = "关机"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 9480
- TabIndex = 30
- Top = 6000
- Width = 1095
- End
- Begin VB.TextBox Text5
- BeginProperty Font
- Name = "宋体"
- Size = 15
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 420
- Left = 1800
- TabIndex = 28
- Text = "1"
- Top = 795
- Width = 615
- End
- Begin VB.CommandButton Command21
- Caption = "检查网络注册模式和注册网络"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 27
- Top = 2160
- Width = 2895
- End
- Begin VB.CommandButton Command20
- Caption = "检查呼叫限制的状态"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 26
- Top = 2640
- Width = 2895
- End
- Begin VB.CommandButton Command19
- Caption = "开机"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7920
- TabIndex = 25
- Top = 6000
- Width = 1095
- End
- Begin VB.CommandButton Command18
- Caption = "查看详细的错误说明"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 24
- Top = 240
- Width = 2895
- End
- Begin VB.CommandButton Command17
- Caption = "重启系统"
- Height = 495
- Left = 5640
- TabIndex = 23
- Top = 7440
- Width = 1815
- End
- Begin VB.CommandButton Command16
- Caption = "恢复到默认设置"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 22
- Top = 5520
- Width = 2895
- End
- Begin VB.CommandButton Command15
- Caption = "设置为数据模式"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 21
- Top = 5040
- Width = 2895
- End
- Begin VB.CommandButton Command14
- Caption = "响铃两声后自动接听"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 20
- Top = 4560
- Width = 2895
- End
- Begin VB.CommandButton Command13
- Caption = "自动接听"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7920
- TabIndex = 19
- Top = 1680
- Width = 1215
- End
- Begin VB.CommandButton Command12
- Caption = "来电显示"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 9240
- TabIndex = 18
- Top = 1680
- Width = 1215
- End
- Begin VB.CommandButton Command11
- Caption = "显示最后一次数据连接的详细情况"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 17
- Top = 4080
- Width = 2895
- End
- Begin VB.CommandButton Command10
- Caption = "查看当前配置"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 16
- Top = 3600
- Width = 2895
- End
- Begin VB.CommandButton Command9
- Caption = "检测GPRS是否连通正常"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 15
- Top = 3120
- Width = 2895
- End
- Begin VB.CommandButton Command8
- Caption = "查询信号质量"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 9240
- TabIndex = 14
- Top = 1200
- Width = 1455
- End
- Begin VB.CommandButton Command7
- Caption = $"gprs.frx":0000
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 13
- Top = 1200
- Width = 1335
- End
- Begin VB.CommandButton Command6
- Caption = "返回Module的软件版本"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 7800
- TabIndex = 12
- Top = 720
- Width = 2895
- End
- Begin VB.TextBox Text2
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 5775
- Left = 0
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 11
- Top = 1680
- Width = 3855
- End
- Begin VB.CommandButton Command5
- Caption = "打开"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 2640
- TabIndex = 10
- Top = 840
- Width = 975
- End
- Begin VB.TextBox Text4
- BeginProperty Font
- Name = "Tahoma"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2415
- Left = 4200
- TabIndex = 8
- Top = 1440
- Width = 3375
- End
- Begin VB.CommandButton Command4
- Caption = "传送"
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 615
- Left = 6240
- TabIndex = 7
- Top = 4080
- Width = 855
- End
- Begin VB.CommandButton Command3
- Caption = "执行"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 6000
- TabIndex = 6
- Top = 1080
- Width = 615
- End
- Begin VB.CommandButton Command2
- Caption = "挂机"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 6960
- TabIndex = 5
- Top = 720
- Width = 615
- End
- Begin VB.CommandButton Command1
- Caption = "拔号"
- BeginProperty Font
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 6960
- TabIndex = 4
- Top = 240
- Width = 615
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- Name = "Tahoma"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 495
- Left = 4200
- TabIndex = 1
- Top = 480
- Width = 2655
- End
- Begin VB.TextBox Text3
- BeginProperty Font
- Name = "Tahoma"
- Size = 14.25
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 2535
- Left = 4320
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- Top = 4800
- Width = 3015
- End
- Begin MSCommLib.MSComm MSComm1
- Left = 0
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- _Version = 393216
- CommPort = 8
- DTREnable = -1 'True
- Handshaking = 2
- RThreshold = 1
- End
- Begin VB.Label Label6
- Caption = "条"
- Height = 255
- Left = 9840
- TabIndex = 37
- Top = 6960
- Width = 495
- End
- Begin VB.Label Label5
- Caption = "收信息号码:"
- Height = 375
- Left = 720
- TabIndex = 33
- Top = 315
- Width = 1695
- End
- Begin VB.Label Label4
- Caption = "COM口:"
- Height = 255
- Left = 600
- TabIndex = 29
- Top = 840
- Width = 975
- End
- Begin VB.Label Label3
- Caption = "等待传送的字符:"
- BeginProperty Font
- Name = "宋体"
- Size = 18
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 855
- Left = 4320
- TabIndex = 9
- Top = 3960
- Width = 1575
- End
- Begin VB.Label Label2
- Caption = "AT指令"
- BeginProperty Font
- Name = "宋体"
- Size = 14.25
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4320
- TabIndex = 3
- Top = 1080
- Width = 975
- End
- Begin VB.Label Label1
- Caption = "电话号码"
- BeginProperty Font
- Name = "宋体"
- Size = 14.25
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 4680
- TabIndex = 2
- Top = 120
- Width = 1335
- End
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Declare Function TextToSms Lib "SMSDLL.dll" (ByVal csc As String, ByVal ToNum As String, ByVal smsnr As String, ByVal flash As Integer, ByVal reportit As Integer, ByRef sms_len As Integer, ByVal retSms As String) As Integer
- Private Declare Function About Lib "SMSDLL.dll" ()
- Private Declare Function SmsToText Lib "SMSDLL.dll" (ByVal sms As String, ByVal csca As String, ByRef caca_len, ByVal ToNum As String, ByRef ToNum_len As Integer, ByVal sendtime As String, ByRef time_len As Integer, ByVal smsnr As String) As Integer
- Const lengcmgl = 14 '"+CMGL: 1,1,,29"的长度:14
- Option Explicit
- Private Sub Command1_Click()
- If Len(Text1.Text) < 7 Then
- MsgBox "电话号码有误,请检查!!", vbCritical + vbOKOnly, "系统讯息"
- Exit Sub
- End If
- MSComm1.Output = "atdt" & Trim(Text1.Text) & vbCrLf
- End Sub
- Private Sub Command10_Click()
- Text4.Text = "AT&V0" ' 查看当前配置、用户方案和存储的电话号码
- End Sub
- Private Sub Command11_Click()
- Text4.Text = "AT&V1" ' 显示最后一次数据连接的详细情况
- End Sub
- Private Sub Command12_Click()
- Text4.Text = "at+clip=1" ' 来电显示
- End Sub
- Private Sub Command13_Click()
- Text4.Text = "ats0=1" ' 自动接听
- End Sub
- Private Sub Command14_Click()
- Text4.Text = "ats1=4" '响铃两声后自动接听
- End Sub
- Private Sub Command15_Click()
- Text4.Text = "at+fclass=0" '设置为数据模式
- End Sub
- Private Sub Command16_Click()
- Text4.Text = "ATZ" ' 恢复到默认设置
- End Sub
- Private Sub Command17_Click()
- MSComm1.Output = "AT+CFUN=0" & vbCrLf '关闭软件
- delay 1000 '延时
- MSComm1.Output = "AT+CFUN=1" & vbCrLf '开启软件
- 'delay 3500 '延时
- 'MSComm1.Output = "AT+CGACT=1,0" & vbCrLf ' //激活GPRS模式
- End Sub
- Private Sub Command18_Click()
- Text4.Text = "AT+CMEE=1" '查看详细的错误说明
- End Sub
- Private Sub Command19_Click()
- Text4.Text = "AT+CGACT=0,0" '开机
- End Sub
- Private Sub Command2_Click()
- MSComm1.Output = "ATH" & vbCrLf
- End Sub
- Private Sub Command20_Click()
- Text4.Text = "AT+CLCK?" '检查呼叫限制的状态
- End Sub
- Private Sub Command21_Click()
- Text4.Text = "AT+COPS?" '检查网络注册模式和注册网络
- End Sub
- Private Sub Command22_Click()
- Text4.Text = "AT+CFUN=0" '关机
- End Sub
- Private Sub Command23_Click()
- Text4.Text = "at+ccid" ' 恢复到默认设置
- End Sub
- Private Sub Command24_Click()
- Dim ret As Integer
- Dim sms_len As Integer
- Dim x As String
- Dim rsms As String * 400
- ret = TextToSms("+8613800510500", hao.Text, Text3.Text, 0, 0, sms_len, rsms)
- x = Trim("AT+CMGF=0" & Chr(13) & Chr(10))
- MSComm1.Output = x '设置短消息发送格式(1-TEXT; 0-PDU)
- delay 100
- x = Trim("AT+CMGS=" + Trim(Str(sms_len)) & Chr(13)) ' & Chr(10))
- MSComm1.Output = x 'Chr(34):"
- delay 100
- x = Left(rsms, ret) 'RTrim(LTrim(Text2.Text))
- Text4.Text = "pdu码:" & x
- MSComm1.Output = x & Chr(26)
- End Sub
- Private Sub Command25_Click()
- Dim receive As String
- Dim time1 As String
- Dim recedat As String
- Dim j As Integer
- '从SIM卡里得到短信代码
- MSComm1.RThreshold = 0 '关闭MSCOMM的自动读取INPUT
- MSComm1.Output = "AT+CMGF=0" & Chr(13) & Chr(10) '以PDU格式读取
- delay 100
- MSComm1.Output = "at+cmgr=" & datindex.Text & Chr(13) & Chr(10)
- delay 1500 '最少要等1秒
- receive = MSComm1.Input
- MSComm1.RThreshold = 1
- '去掉多余信息,取得纯PDU代码
- j = InStr(receive, "+CMGR:") + lengcmgl '"+CMGL: 1,1,,29"的长度:
- time1 = Left(receive, 27) '得到前面的部分
- recedat = Mid(receive, j) '去掉前面的部分
- recedat = Left(recedat, InStrRev(recedat, "OK") - 1) '去掉最后的OK和回车换行
- Dim csca As String * 30
- Dim csca_len As Integer
- Dim num As String * 30
- Dim num_len As Integer
- Dim sendtime As String * 30
- Dim time_len As Integer
- Dim nr As String * 300
- Dim nr_len As Integer
- Dim i As Integer
- i = SmsToText(RTrim(LTrim(recedat)), csca, csca_len, num, num_len, sendtime, time_len, nr)
- Text2.Text = "短信中心:" + csca
- Text2.Text = Text2.Text + Chr(13) + Chr(10) + "来源: " + num
- Text2.Text = Text2.Text + Chr(13) + Chr(10) + "时间: " + Trim(LTrim(sendtime))
- Text2.Text = Text2.Text + Chr(13) + Chr(10) + "短信内容:" + nr
- End Sub
- Private Sub Command26_Click()
- Text4.Text = "at+cmgd=" & datindex.Text
- End Sub
- Private Sub Command27_Click()
- '从SIM卡里得到 全部短信代码
- Dim receive As String, receive1 As String
- receive = ""
- MSComm1.Output = "AT+CMGF=0" & Chr(13) & Chr(10) '以PDU格式读取
- delay 1500
- MSComm1.RThreshold = 0 '关闭MSCOMM的自动读取 INPUT
- MSComm1.Output = "at+cmgl=4" & Chr(13) & Chr(10)
- Do
- delay 100
- receive1 = MSComm1.Input
- receive = receive & receive1
- Loop Until InStr(receive, "OK") > 0
- MSComm1.RThreshold = 1
- '分析代码:1、将多条信息分开
- Dim countrecord As Integer
- Dim i As Integer, iend As Integer, j As Integer
- Dim datrecord(20) As String * 200
- countrecord = 0
- i = InStr(receive, "+CMGL:")
- iend = InStrRev(receive, "OK")
- While i > 0 And i < iend
- j = InStr(i + 1, receive, "+CMGL:")
- If j <= 0 Then j = iend
- datrecord(countrecord) = Mid(receive, i, j - i)
- i = j
- countrecord = countrecord + 1
- Wend
- i = MsgBox("总共有" + Str(countrecord) + "条信息", vbOKOnly)
- '分析代码:2 、PDU转换成TEXT,并显示出来
- Dim csca As String * 30
- Dim csca_len As Integer
- Dim num As String * 30
- Dim num_len As Integer
- Dim sendtime As String * 30
- Dim time_len As Integer
- Dim nr As String * 300
- Dim nr_len As Integer
- Text5.Text = ""
- For iend = 0 To countrecord - 1
- j = InStr(datrecord(iend), "+CMGR:") & lengcmgl & 3 '"+CMGL: 1,1,,29"的长度:
- datrecord(iend) = Mid(datrecord(iend), j) '去掉前面的部分
- i = SmsToText(RTrim(LTrim(datrecord(iend))), csca, csca_len, num, num_len, sendtime, time_len, nr)
- Text2.Text = Text2.Text & Chr(13) & Chr(10) & Chr(13) & Chr(10) & "第" & Str(iend & 1) & "条短信"
- Text2.Text = Text2.Text & Chr(13) & Chr(10) & "短信中心:" & csca
- Text2.Text = Text2.Text & Chr(13) & Chr(10) & "来源: " & num
- Text2.Text = Text2.Text & Chr(13) & Chr(10) & "时间: " & Trim(LTrim(sendtime))
- Text2.Text = Text2.Text & Chr(13) & Chr(10) & "短信内容:" & nr
- Next
- End Sub
- Private Sub Command28_Click()
- Text4.Text = "at+cmgd=1,4"
- End Sub
- Private Sub Command3_Click()
- MSComm1.Output = Text4.Text & Chr(13) & Chr(10)
- 'Command3.Enabled = False
- delay 2500 '延时
- End Sub
- Private Sub Command4_Click()
- MSComm1.Output = Text3.Text
- End Sub
- Private Sub Command5_Click()
- If Text5.Enabled = True Then
- MSComm1.CommPort = Text5.Text
- On Error Resume Next
- If MSComm1.PortOpen Then
- MsgBox "串口已被其他设备所使用!", vbExclamation + vbOKOnly, "系统讯息"
- Exit Sub
- Else
- MSComm1.PortOpen = True
- End If
- MSComm1.Output = "AT+CFUN=1" & vbCrLf '开启软件
- Text5.Enabled = False
- Command5.Caption = "关闭"
- Else
- MSComm1.Output = "at+cpof" & vbCrLf '关闭
- MSComm1.Output = "AT+CFUN=0" & vbCrLf '关闭软件
- delay 200 '延时
- MSComm1.PortOpen = False
- End
- End If
- End Sub
- Private Sub Command6_Click()
- Text4.Text = "at+cgmr" '返回Module的软件版本
- End Sub
- Private Sub Command7_Click()
- Text4.Text = "at+cnum" 'SIM卡认证
- End Sub
- Private Sub Command8_Click()
- Text4.Text = "at+csq" '//查询信号质量
- End Sub
- Private Sub Command9_Click()
- Text4.Text = "AT+CGREG?" '//检测GPRS是否已经联通
- End Sub
- Private Sub Form_Load()
- 'MSComm1.Output = "AT+CFUN=1" & vbCrLf '开启软件
- ' 当响铃二次时,Modem 即自动接通
- 'MSComm1.Output = "ATS1=2" & vbCrLf
- 'delay 200 '延时
- End Sub
- Private Sub MSComm1_OnComm()
- Dim t&, Buf$, StrPos%
- Select Case MSComm1.CommEvent
- ' 藉着取代底下每一个 case 陈述式来处理每个事件与错误
- ' 事件
- Case comEvCD ' CD 线的状态发生变化.
- Case comEvCTS ' CTS 线的状态发生变化.
- Case comEvDSR ' DSR 线的状态发生变化.
- Case comEvRing ' Ring Indicator 变化.
- Case comEvReceive ' 收到 RThreshold # of Data
- t = GetTickCount()
- Do
- DoEvents
- Loop Until GetTickCount - t >= 100
- Text2.Text = Text2.Text + Trim(MSComm1.Input)
- '将位置移到最後,以便看到最新的结果
- Text2.SelStart = Len(Text2.Text)
- Case comEvSend ' 传输暂存区有 Sthreshold 个字元 '
- End Select
- End Sub