i have this project of creating a simple program of creating and sending SMS.
i am using Visual Basic. my GUI is a simple panel with a textbox for the destination number, the message center and the message. and 3 buttons; send, clear and close.
i am having a problem with my codes and i dont know how to correctly use them... i have a PC Suite installed in my computer which is able to detect that my 7610 phone is connected to the computer via USB. But then, when I use the program that I created, it always prompts an error saying the "No phone is connected"
please please, i urgently need help on this...
below is the code that i used, please, anyone help me....
'*********************************************************************
'
' Texting Application
'
'*********************************************************************
Private pSMSAdapter As NokiaCLMessaging.ShortMsgAdapter
Private pIGSMSubmit As NokiaCLMessaging.IGSMSubmit
Private pSMSMessageItem As NokiaCLMessaging.ShortMessageItem
Private pIGSMDeliver As NokiaCLMessaging.IGSMDeliver
Private pIMemory As NokiaCLMessaging.IMemory
Private pMsgPart1 As String
Private pMsgPart2 As String
Private Const CODING_SCHEME_TEXT = 0
Private Const SMS_TEXT_MAX_SIZE = 160
Private Const SMS_CONCATENATED_TEXT_MAX_SIZE = 153
' This funtion displays the error message for every form
Public Sub ShowError()
MsgBox "Source: " & Err.Source & Chr$(10) _
& "ErrorDescription: " & Err.Description _
& Chr$(10) & "HelpContext: " & Err.HelpContext
End Sub
Private Sub SendConcatenatedMessage()
On Error GoTo ErrorTrap
Dim smsEntry As NokiaCLMessaging.ShortMessageItem
Set smsEntry = New NokiaCLMessaging.ShortMessageItem
Dim headerArray(0 To 5) As Byte
smsEntry.Type = SHORTMESSAGE_TYPE_GSM_SUBMIT
Set pIGSMSubmit = smsEntry.TypeProperties
pIGSMSubmit.message = pMsgPart1
pIGSMSubmit.DestinationAddress = txtNumber.Text
pIGSMSubmit.ServiceCenterAddress = msgCenter.Text
pIGSMSubmit.ProtocolID = 0
pIGSMSubmit.DataCodingScheme = 0
pIGSMSubmit.ValidityPeriodRelative = 255
headerArray(0) = 5 'header lenght
headerArray(1) = 0 'concatenated sms
headerArray(2) = 3 'length of information element A
headerArray(3) = 50 'reference number
headerArray(4) = 2 '2 messages
headerArray(5) = 1 'sequence number of sms
pIGSMSubmit.UserDataHeader = headerArray
Call pSMSAdapter.SendSMS(SHORTMESSAGE_ROUTE_TYPE_ANY, pIGSMSubmit)
pIGSMSubmit.message = pMsgPart2
pIGSMSubmit.DestinationAddress = txtNumber.Text
pIGSMSubmit.ServiceCenterAddress = msgCenter.Text
pIGSMSubmit.ProtocolID = 0
pIGSMSubmit.DataCodingScheme = 0
pIGSMSubmit.ValidityPeriodRelative = 255
headerArray(0) = 5 'header lenght
headerArray(1) = 0 'concatenated sms
headerArray(2) = 3 'length of information element A
headerArray(3) = 51 'reference number
headerArray(4) = 2 '2 messages
headerArray(5) = 2 'sequence number of sms
pIGSMSubmit.UserDataHeader = headerArray
Call pSMSAdapter.SendSMS(SHORTMESSAGE_ROUTE_TYPE_ANY, pIGSMSubmit)
MsgBox ("Concatenated MEssage sent")
Exit Sub
ErrorTrap:
ProjectDB.ShowError
End Sub
Private Sub cmdClear_Click()
txtMessage.Text = " "
txtNumber.Text = "+63"
msgCenter.Text = "-----------------------"
End Sub
Private Sub cmdClose_Click()
Unload ProjectDB
End Sub
Private Sub cmdSend_Click()
Dim message As String
message = txtMessage.Text
On Error GoTo ErrorTrap
If (Len(message) > SMS_TEXT_MAX_SIZE) Then
pMsgPart1 = Left(message, SMS_CONCATENATED_TEXT_MAX_SIZE)
pMsgPart2 = Right(message, Len(message) - SMS_CONCATENATED_TEXT_MAX_SIZE)
SendConcatenatedMessage
Exit Sub
End If
Dim smsEntry As NokiaCLMessaging.ShortMessageItem
Set smsEntry = New NokiaCLMessaging.ShortMessageItem
smsEntry.Type = SHORTMESSAGE_TYPE_GSM_SUBMIT
Set pIGSMSubmit = smsEntry.TypeProperties
pIGSMSubmit.message = txtMessage.Text
pIGSMSubmit.DestinationAddress = txtNumber.Text
pIGSMSubmit.ServiceCenterAddress = msgCenter.Text
pIGSMSubmit.ProtocolID = 0
pIGSMSubmit.DataCodingScheme = CODING_SCHEME_TEXT
pIGSMSubmit.ValidityPeriodRelative = 255
Call pSMSAdapter.SendSMS(SHORTMESSAGE_ROUTE_TYPE_ANY, pIGSMSubmit)
MsgBox ("Message sent with reference number: " & pIGSMSubmit.MessageReference)
Exit Sub
ErrorTrap:
ProjectDB.ShowError
End Sub
Private Sub Form_Load()
On Error GoTo ErrorTrap
Set pSMSAdapter = New NokiaCLMessaging.ShortMsgAdapter
Set pSMSMessageItem = New NokiaCLMessaging.ShortMessageItem
Set pIMemory = pSMSAdapter
Set parameterEntry = pIMemory.GetParameters(PARAMETERS_TYPE_GSM, 1)
txtServiceCenterNumber.Text = parameterEntry.ServiceCenterAddress
Exit Sub
ErrorTrap:
ProjectDB.ShowError
End Sub
'**********************************************
please tell me the problem with this code and please correct this... need reply to this thread ASAP... due date is fast approaching..... please please...
tnx to those who will reply and help me with this.![]()



