在VB6中从PC发送长消息到手机
Sending Long Message form pc to mobile in VB6
我想从电脑向手机发送长短信(超过 160 个字符)。我在 VB6 中使用 MSComm 控件。它适用于小消息,但当我的消息超过 160 个字符时,它显示发送正常但消息未送达。
With MSComm1
.CommPort = port
.Settings = "9600,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True 'must be the last
End With
'Send an 'AT' command to the phone
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf 'This line can be removed if your modem will always be in Text Mode...
Sleep 500
MSComm1.Output = "AT+CMGS=" & Chr(34) & mnumber & Chr(34) & vbCrLf 'Replace this with your mobile Phone's No.
Sleep 1000
MSComm1.Output = TxtMessage.Text & Chr(26)
您不能发送超过 160 个字符限制的消息。
当您的 phone 收到一条长消息时,它实际上接收了多条消息并将它们拼接在一起,这称为 串联短信 。
为此,您需要从文本模式(您当前与设备交互的方式)切换到PDU模式;这使您能够手动设置 SMS 消息 header (UDH)。
在 UDH 中,您可以设置一个标志 (IEI),指示该消息是一个串联的 SMS、部分总数和当前部分号。然后你可以发送多条短信,靠接收端把它们粘在一起。
我想从电脑向手机发送长短信(超过 160 个字符)。我在 VB6 中使用 MSComm 控件。它适用于小消息,但当我的消息超过 160 个字符时,它显示发送正常但消息未送达。
With MSComm1
.CommPort = port
.Settings = "9600,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True 'must be the last
End With
'Send an 'AT' command to the phone
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf 'This line can be removed if your modem will always be in Text Mode...
Sleep 500
MSComm1.Output = "AT+CMGS=" & Chr(34) & mnumber & Chr(34) & vbCrLf 'Replace this with your mobile Phone's No.
Sleep 1000
MSComm1.Output = TxtMessage.Text & Chr(26)
您不能发送超过 160 个字符限制的消息。
当您的 phone 收到一条长消息时,它实际上接收了多条消息并将它们拼接在一起,这称为 串联短信 。
为此,您需要从文本模式(您当前与设备交互的方式)切换到PDU模式;这使您能够手动设置 SMS 消息 header (UDH)。
在 UDH 中,您可以设置一个标志 (IEI),指示该消息是一个串联的 SMS、部分总数和当前部分号。然后你可以发送多条短信,靠接收端把它们粘在一起。