Private Function Sendsms(num As String, msg As String) As Boolean '短信发送
Dim PDU, psmsc, pnum, pmsg, buf As String
Dim Leng As String
Dim Length As Integer
Length = Len(msg)
Length = 2 * Length
Leng = Hex(Length)
If Length < 16 Then Leng = "0" & Leng
psmsc = Trim(telc("8613800758500"))
pnum = Trim(telc(num))
pmsg = Trim(StrConv(msg, vbUnicode))
PDU = prex & psmsc & midx & pnum & sufx & Leng & pmsg
Sleep (1)
Call Portopen_Test
Mobcomm.Output = "AT+CMGF=0" + vbCr
Mobcomm.Output = "AT+CMGS=" & Str(15 + Length) + vbCr
Sleep (500)
If Mobcomm.InBufferCount > 0 Then
Mobcomm.InputLen = 0
buf = Mobcomm.Input
If InStr(buf, ">") Then
Mobcomm.Output = PDU & Chr$(26)
buf = ""
End If
End If
If Mobcomm.InBufferCount > 0 Then
Mobcomm.InputLen = 0
buf = Mobcomm.Input
If InStr(buf, "OK") Then
buf = ""
Sendsms = True
End If
End If
End Function
Private Sub readsms(rnum As String) '接收信息
Mobcomm.Output = "AT+CMGF=1" + vbCr
Mobcomm.Output = "AT+CMGR=" & rnum + vbCr
End Sub
Private Sub Command1_Click()
myActiveX.Active = False
myActiveX.ComPort = Combo1(1).Text
myActiveX.baudrate = Int(Val(Combo2(1).Text))
MsgBox "设置端口号为:" & Combo1(1).Text & ",波特率为:" & Combo2(1).Text & tl
myActiveX.Active = True
End Sub
Private Sub Command2_Click()
msg.Text = ""
End Sub
Private Sub Command3_Click()
DebugText "================= SIM卡信息 ====================="
DebugText " SIM卡IMSI: " + myActiveX.IMSI
DebugText " 短信中心: " + myActiveX.SCA
DebugText " 所属网络: " + myActiveX.Provider
DebugText " 短信数目: " + myActiveX.SMSMemUsed
DebugText " 短信容量: " + myActiveX.SMSMemTotal
www.chuibin.com = 0
Mobcomm.InputLen = 0
Sleep (100)
'Mobcomm.Output = "AT+CMGF=1" + vbCr
'Sleep (400)
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页