Sending Long Message form pc to mobile in VB6

968 Views Asked by At

I want to send long sms (more than 160 characters) from pc to mobile. I am using MSComm control in VB6. It works good with small messages but when my message exceeds 160 characters then it shows sending ok but message is not delivered.

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)
1

There are 1 best solutions below

1
On BEST ANSWER

You cannot send a message that exceeds the 160 character limit.

When your phone receives a long message its actually receiving multiple messages and stitching them together, this is called Concatenated SMS.

To do this you would need to switch from Text Mode (how you are currently interacting with the device) to PDU mode; this enables you to manually set the SMS message header (UDH).

Within the UDH you can set a flag (IEI) indicating that the message is a concatenated SMS, the total number of parts and the current part number. You can then send multiple short messages and rely on the receiving end sticking them together.