I'm using following code for sending SMS from Powerbuilder using a GSM Modem.
I have use Nokia 6300 cell phone as a modem and connected to Nokia PC Suite that use COM5 Port.
When i call this code my application was not responding and message has not been sent, when i was debug then application is stop response on First FileWriteEx() function call.
so please any body know about that issue then please guide me.
Thanks in advance..
the following code i was used for SMS.
integer li_FileNum
string ls_MobileNo
string ls_Message
string ls_ComPort, ls_String
string szEnd
string szCommand
Long ll_rc
ls_MobileNo = sle_mobileNo.text
ls_Message = sle_msg.text
ls_ComPort = sle_ComPort.text
szEnd = char(26)
li_FileNum = FileOpen(ls_ComPort, TextMode!,Write!,LockWrite!,Append!)
if li_FileNum > 0 then
ll_Rc = FileWriteEx(li_FileNum, "AT+CMGF=1")
FileWriteEx(li_FileNum, "~n~r")
szCommand = "AT+CMGS="
szCommand += "~""+ ls_MobileNo +"~""
FileWriteEx(li_FileNum, szCommand)
FileWriteEx(li_FileNum, "~r")
FileWriteEx(li_FileNum, ls_Message)
ll_Rc = FileWriteEx(li_FileNum, ls_String )
FileWriteEx(li_FileNum, szEnd)
FileClose(li_FileNum)
MessageBox("Sms Application" , "Sms sent successfully....")
// sle_MobileNo.text = ""
// sle_Msg.text = ""
else
MessageBox("Sms Application" , "Unable to open Com Port ....")
end if
Best Regards
Usman Ali
I have use Nokia 6300 cell phone as a modem and connected to Nokia PC Suite that use COM5 Port.
When i call this code my application was not responding and message has not been sent, when i was debug then application is stop response on First FileWriteEx() function call.
so please any body know about that issue then please guide me.
Thanks in advance..
the following code i was used for SMS.
integer li_FileNum
string ls_MobileNo
string ls_Message
string ls_ComPort, ls_String
string szEnd
string szCommand
Long ll_rc
ls_MobileNo = sle_mobileNo.text
ls_Message = sle_msg.text
ls_ComPort = sle_ComPort.text
szEnd = char(26)
li_FileNum = FileOpen(ls_ComPort, TextMode!,Write!,LockWrite!,Append!)
if li_FileNum > 0 then
ll_Rc = FileWriteEx(li_FileNum, "AT+CMGF=1")
FileWriteEx(li_FileNum, "~n~r")
szCommand = "AT+CMGS="
szCommand += "~""+ ls_MobileNo +"~""
FileWriteEx(li_FileNum, szCommand)
FileWriteEx(li_FileNum, "~r")
FileWriteEx(li_FileNum, ls_Message)
ll_Rc = FileWriteEx(li_FileNum, ls_String )
FileWriteEx(li_FileNum, szEnd)
FileClose(li_FileNum)
MessageBox("Sms Application" , "Sms sent successfully....")
// sle_MobileNo.text = ""
// sle_Msg.text = ""
else
MessageBox("Sms Application" , "Unable to open Com Port ....")
end if
Best Regards
Usman Ali