View Full Version : XDA and SMS programming
Anonymous
10-02-2003, 11:28 AM
Hello,
I'm new in the wonderful world of XDA and Pocket PC 2002, and I would like to use SMS in a new application. Do you know how I could see example of source code using SMS API? Or do you have such example to help me?
Thanx
Gizmo
Anonymous
10-02-2003, 11:31 AM
I forget something important : I'm using eMbedded Visual C++ 3.0!!
Thanx
Gizmo
Cheesy
10-02-2003, 12:42 PM
All you have to do is include SMS.H in your code and linkt to SMS.LIB, see online documentation for more details. Below a simple function which takes a phone number in international format (+491715555555) and the message as parameters ...
BOOL SendSMS(LPCTSTR pszNumber, LPCTSTR pszMessage)
{
SMS_HANDLE hSMS;
HANDLE hGlobalReadSMSEvent;
HRESULT hResult;
hResult= SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &hSMS, &hGlobalReadSMSEvent);
if(hResult != S_OK)
{
AfxMessageBox(_T("Couldn't open the SMS function"));
return FALSE;
}
SMS_ADDRESS smsaDestinationAddress;
smsaDestinationAddress.smsatAddressType= SMSAT_INTERNATIONAL;
wcscpy(smsaDestinationAddress.ptsAddress, pszNumber);
TEXT_PROVIDER_SPECIFIC_DATA tpsd;
tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE;
tpsd.psMessageClass = PS_MESSAGE_CLASS3;
tpsd.psReplaceOption = PSRO_NONE;
hResult= SmsSendMessage(hSMS, NULL, &smsaDestinationAddress, NULL, (BYTE*)pszMessage,
wcslen(pszMessage)*sizeof(WCHAR), (BYTE*)(&tpsd), sizeof(tpsd), SMSDE_OPTIMAL, SMS_OPTION_DELIVERY_NONE, NULL);
if(hResult != S_OK)
{
AfxMessageBox(_T("Couldn't send the SMS"));
return FALSE;
}
hResult = SmsClose(hSMS);
if(hResult != S_OK)
{
AfxMessageBox(_T("Couldn't close the SMS function"));
return FALSE;
}
AfxMessageBox (_T("SMS has been send"));
return TRUE;
}
Anonymous
10-02-2003, 02:38 PM
Thanx! Thanx!
I made a big mistake : I forgot to link the SMS.LIB....
I'm a beginner!! (and I'm French : I'm sorry for the bad english language!)
Have a great week!
Gizmo
Anonymous
26-06-2003, 11:05 AM
Hello,
Does anybody has a code example for receiving SMS messages?
I've trying to do so for two weeks, and I'm completely lost. :(
I've read in this site it can't be done with SmsReadMessage or SimReadMessage. Is it correct? What have I to do, using RIL? Or can I use POOM?
Any help would be very appreciated.
APallares
andyclap
26-06-2003, 01:21 PM
Have you seen tstril? It shows a good way of handling incoming SMSs.
It's here http://xda-developers.com/RIL/
Anonymous
27-06-2003, 11:05 AM
Yes, I've took a look at tstrill. But this example only shows notifications on what's happening on the SMS channels. It has't any reference to the RIL_ReadMsg.
I've searched on the patent documentation, and I have found this help on the RIL_ReadMsg function:
HRESULT RIL_ReadMsg(HRIL hRil, DWORD dwIndex)
Reads a message from the current storage Location
Parameters:
hRil: handle to RIL instance returned by RIL_Initialize
dwIndex:
index of the message to be read
Comments:
Asynchronous. lpData points to an RILMESSAGEINFO structure
My question is: How do I access to lpData?
What I want to do is a function on a DLL like this (in pseudo-code):
BOOL WINAPI ReadSMSMessage(int numMens, LPTSTR Message){
RIL_Initialize
RIL_ReadMessage
RIL_DeInitialize
}
But, what I have to do to get access to "lpData"?
Thanks,
APallares
ballrock2
15-07-2003, 12:07 PM
Have the sms.lib now. Normaly it's delivered with dthe EVC - but the 2 Versions I've got doesn't have it. Get them now by eMail
Maybee, this is the super-beginner-question - sorry
I'm searching for the SMS.lib and SMS.h . Working with MS EVC++ 3.0.
Every time, if I try to compile, I get the message, that the files couldn't been found.
Thougt to get them from the internet - but found them nowhere.
I'm happy about every tip (excluding "you're stupid" ;o)
Greetings from hannovre,
Andreas :o)
[/b]
nutitija
14-10-2005, 05:39 AM
Look in ProgramFiles / Windows CE Tools / WCE420 / PocketPC2002 / LIB / Armv4 / all your libraries should be stored there ... in ur code FILE VIEW , Source Files, right click and select add Files to Folder and add your lib
else just #inclde "<the full lib path>"
@nutitija
You are aware of the fact that this thread is more than two years old http://img115.exs.cx/img115/8895/signquestion3xd.gif
Sascha
nutitija
14-10-2005, 01:34 PM
poor guy could still be waiting for an answer ....
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.