gpt4 book ai didi

vb6 - 在VB6中从PC发送长消息到手机

转载 作者:行者123 更新时间:2023-12-01 12:30:04 25 4
gpt4 key购买 nike

我想从电脑向手机发送长短信(超过 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 个字符限制的消息。

当您的手机收到一条长消息时,它实际上会收到多条消息并将它们拼接在一起,这称为串联短信

为此,您需要从文本模式(您当前与设备交互的方式)切换到PDU 模式;这使您能够手动设置 SMS 消息 header (UDH)。

在 UDH 中,您可以设置一个标志 (IEI),指示该消息是一个串联的 SMS、部分总数和当前部分号。然后,您可以发送多条短消息,并依靠接收端将它们粘在一起。

关于vb6 - 在VB6中从PC发送长消息到手机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35020860/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com