Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send SMS from PowerBuilder

Status
Not open for further replies.

nashid4u

Programmer
Oct 22, 2014
1
PK
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top