Read SMS - Windows Mobile Development and Hacking General

Hello!
I have some difficulties to read SMS in my application : my application doesn't want to use the fonction SmsOpen in mode RECEIVE. Do you know the parameters to use in this function to read Sms?
Gremlins (and I'm not Gizmo!)

funny as Gizmo asked me exact the same question via private mail ...
This was my response:
----------------------------------------
I've never used the function to read SMS messages but here is my suggestion:
check the return code of SmsOpen, it is probably SMS_E_RECEIVEHANDLEALREADYOPEN. According the SDK help it means, that another app has already opened and is using the provider. In most cases, that might be Inbox, so shut down the Inbox task befor you are running your code.
If your error code is different, check the meaning in the help file, look for SmsOpen -> SMS specific error codes.

You don't have disable Inbox. The problem is the internal SMS handler - if you look in \Windows\Startup, you'll see a SMSHandler (I don't have a T-Mobile at the moment, so can't confirm the exact name). You need to get your application to start before it. In addition, you need to do a SmsSetMessageNotification() for both SMS_MSGTYPE_RAW as well as SMS_MSGTYPE_TEXT message types. Strangely, the code does not get the notification if you only set it for one of the two.

I have a T-Mobile MDA. There is a folder called "AutoStart" in the Windows folder, so I guess the file called "SMSReceiver.exe" is the handler you were talking about. I named my application "aaamyapplication" in order to start it up first after a soft reset (There is actually no "startup" registry-entry either for "SMSReceiver" nor for my application... in the end I kicked "SMSReceiver" out).
Unfortunately receiving an SMS through my app does not work (but strangely the system is still able to receive SMS in spite of deleting "SMSReceiver").
Do you have a good guess what I should do? I would be grateful for any advice
t_lex

Could some body be more specific on what Jvd said ??? i'm running an XDA2 and when i look in windows/startup i only get the followng :
CheckAutoRun
ChgDfLnk
IA_Caller_ID
MMReg
poutlook
stk
wifiIcon

Related

Scripting a text message for London Congestion Charge

Hi there,
Is it possible (or could any kind developper!) to script a text message that would always have the same text.
Basically to pay the London Congestion Charge (£5 for driving into Central London), one needs to send a text message to the number 81099 containing the last four digits of their credit card.
As the message is always the same, I thought it might be easy to script such a message to make it easy to pay the charge.
Thanks!
isn't that easy? set up your pre set messages as the words and numbers u need so then u create a new text and click my text chose the one u want and send it!
Hi,
Thanks for your reply. I see what you mean, but that is still several clicks more than I have in mind. With a script/batch file, it would literally be a one button (through a shortcut) click which could even be assigned to a hardware button. Lazy ... maybe! I guess it all really depends on whether the function to send a text message can be accessed from the command line.
no kidding ur lazy!
You can write smssender.html which will include a javascript, that will redirect you to:
mailto:123456789 body="Send me a taxi!" - I'm not sure about the syntax...
Everytime you execute this webpage, you will only have to confirm SMS sending and close IE (I don't know if window-terminating scripts work in PocketIE) :idea:
(!)
I don't know if you're willing to pay for it, but there is a utility called Cell Profiler found here
You can pre-define an SMS to be sent to a particular number when you drive through a particular point.
Download the trial and see if it fits in with your requirements.
You can use the scripting utility called nscriptm to automate your screen taps etc. Give it a go. Its fairly simple and there is a good sample that shows you how to work with screen taps.
Thanks for your replies. I will try each and see what works best for me.
Thanks again!
XDA2-owner said:
Hi there,
Is it possible (or could any kind developper!) to script a text message that would always have the same text.
Basically to pay the London Congestion Charge (£5 for driving into Central London), one needs to send a text message to the number 81099 containing the last four digits of their credit card.
As the message is always the same, I thought it might be easy to script such a message to make it easy to pay the charge.
Thanks!
Click to expand...
Click to collapse
I wonder if I understand you correctly. In my SMS messaging on the XDAII I have something called My Text as a menychoise. The predefined messages in there can be added/amended in the Edit menu...You could do it easily there...?
Hi,
Yeah - someone mentioned that earlier. What I was really looking for though was a literally one-button way to pay my congestion charge - basically a shortcut to a batch-file/script that creates the SMS, enters the text and addresses it correctly.
Does anyone know if the mailto: command that you can use to create an e-mail would work for an SMS? If so, that would be fine as within the mailto: command you can specify the recipient (81099 in this case) and the text (credit card digits).
Thanks for all the responses.
1. PPCs don't make any difference between e-mails and short messages - you have same dialog, same options and same mailto: command...
2. JavaScript in HTML page is probably the fastest way to perform actions you need (if you dont want to write it in C++ of coz!)
3. If I'm not too drunk today I'll have probably posted an example of such page by tomorrow - I finished with school today, so I have something to celebrate! 8)
Would be great to see a javascript sample if you could be bothered/sober enough to put one together.
Thanks very much indeed.
So, that's what it looks like:
<html><body>
<script language="JavaScript">
window.location="mailto:81099?body=Here's my creditcard number!"
</script>
</body></html>
mailto: - where
body: - what
You can also add subject: (don't forget to divide it with "?" :!: )
It looks like Pocket IE does not support close() function. Can anyone confirm? Any way, even if you will have to close IE manually, executing this file (possibly from Today screen) and pressing SEND is still faster than going to New>SMS>MyText>choose>enter number>confirm... 8)
That worked just great! Thank you so much.
I used the PHM Pocket PC PowerToys's TrayLaunch program to put a shortcut to the .htm file onto the bottom bar of the Today screen.
I still need to press the Send button (is there a way to automate that?) and close IE but it's still MUCH quicker than doing it through a manual SMS.
Thanks again for all comments and help.
Compose new text message from shortcut
Hi there,
I'm a total newbie (NOT a programmer at all), just a Qtek 9090 addict. I 've been looking for something similar to your request: I wanted a way to go straight to the "compose text message" window from the today screen or a hardware button. I finally found a way to do this (maybe not the best way, but I can't find a site that lists all the possible parameters for tmail.exe).
If you're still looking for a better way to automatically launch your message, try this:
Copy the "Messaging" shortcut from Windows/Start Menu and put the copy somewhere you can work on it. Rename it to something like "London Congestion".
If you have Resco file explorer on your device, select your new shortcut and view its properties. On the second tab ("shortcut"), you should see the line "\Windows\tmail.exe". Change it to this:
"\Windows\tmail.exe" -service "text" -to "81099" -body "your credit card number"
Then tap "ok".
Move your new shortcut to Windows/Start Menu/Programs. Now you should be able to access it with your Today screen launcher or Button launcher.
If you don't have Resco file explorer, copy your shortcut to your desktop and open it with Notepad. You'll see something like 43#"\Windows\tmail.exe"; just leave the number at the front, make the adjustments I described and save the file. Then put it in Windows/Start Menu/Programs on your device.
I tested this and it worked for me, so I hope it does for you too!
To simply go to the "compose" window from a shortcut, I use this line:
"\Windows\tmail.exe" -service "text" -to ""
Robrecht.
Thanks a lot Robrecht,
I was actually going to re-open this issue because I have a Blueangel now - and I don't know if it's because it is WM2003 Second Edition or not, but the javascript that was written for me in the above post no longer works, so I needed a new method.
A very timely reply and I will try it over the weekend.
Thanks a lot,
Jimmy
I think you should add "I hope it chokes you bunch of rip off bastards" We pay road tax, we pay huge tax on fuel, we sit for hours in jams and they want money :?:
Well, XDA2-owner, you're very welcome!!!
I have a Blue Angel too and it works for me, except....... I discovered a flaw.
I thought the
-service "text"
parameter made sure the automatically created message was always a text (SMS) message, but instead it turns out that the format of the new message (SMS, e-mail, MMS...) changes according to the last viewed folder in Pocket Outlook. So if you were checking your e-mail account just before you use my shortcut, it wil create an e-mail instead of a text message.
This sucks! And I was so happy I'd been able to help someone!
Does anyone know a way to make sure the new message is always a text message?
Hi again,
This issue was one I was also having with the Javascript - I got used to the fact that if I was using the e-mail part of Messaging, I would switch it back to SMS before closing it.
One issue I am having though - and it might just be to do with my setup - is that when I run the shortcut from Start-->Programs-->Congestion, it works fine. When I try and launch it from my Today screen though, using BatteryPackPro, it doesn't seem to create the text message, and just stays on the Today screen.
Any ideas?
Thanks again for your help and ideas.

SMS program

Hi Folks,
This is my first post, although I've owned my XDAIIs for several weeks and I've ROM'd it to the iMATE 1.4 ROM. So I've had a good play.
I was looking at smsOrganizer (from Jeyo) which is badly supported (and it ain't free) and I wondered why I (we) couldn't write something to do the same thing, for free.
Is there a forum for this kind of activity, or could someone point me in the direction of some exmples of how to pass data between the PC and phone?
Best regards
AndrwB
Andrew, look into RAPI: eg here
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarppc2k/html/ppc_teapppi.asp
Development and Hacking is the right place for this kind of query...what do you want the app to do?
V
Hi V,
Basically I want to control the SMS message transfer on my XDA from Outlook, just like smsOrganizer.
Re. your link, I think we've got those? but I generally write embedded C, non of this fancy C++ stuff :-((
AndrewB
Hi V,
I just tried this :
http://support.microsoft.com/default.aspx?scid=kb;en-us;307256
And I can now copy files to and from my device
Not bad for 1 hours playing, specially as I've fixed 2 work related bugs too )
Andrew B
Good stuff.
I'm just learning C++ actually, I never learnt C, coming from self-taught VB on the PC.
RAPI is the way to do most PC<>PDA communications, although right now I'm only just getting into sms stuff. It'd be easy enough (I think) to write an interface to create an SMS on the PC in text, transmit that to the PDA and then SMS it off, but the backend of it would require some implementation.
Keep us posted though!
V
99% of c programs should compile and work just fine on
c++ compilers and you can write c++ programs without using
oop in which case they are pretty much c programs
From what I've read it looks as if you need to write an app to sit on the device and another app on the main PC. The app on the phone just acts as an agent passing data between the sms services and the PC.
Anybody got any ideas?
AndrewB
Yipeeeee
I can now write a DLL that sits on the device and I can write a C++ application on my PC to communicate with it
Now to start reading some text messages from the device to the PC......
Does anybody know agood way to send and recieve SMS ?? I would also like to edit the text and pass it to an Edit Box.
I am not too sure about the available API's that will let me do this.
Please HELP :shock:
Hey , i would like to send and recieve SMS on my xda2. Also pass the recieved message into an Edit Control. Does anybody know a good way to do this ??
I know about the SMS API but i am unaware of others. Pleas Help !! thnkx
SMS Auto sending
Hi everybody,
Is there a way to auto send all sms in draft? Basically, every sms in draft folder needs to be send one by one by ticking send button.
OK,
I can now send a text message from my PC to a DLL on my phone using RAPI, then send a SMS using MAPI.
The trouble is I can't get the subject and body fields to display correctly on my XDAIIs. Also I can't get the Name to appear instead of the number.
I'll try to post the code later on the understanding that it is FREE and we pool our experiences/knowledge.
Here is the code for the DLL and the PC program. Just press one of the keys on the tol bar to send the message. The number and message are hard coded.
There are ABSOLUTELY NO guarentees with this code, use it at you own risk.
can it recieve SMS as well ?? Has any body thought about other API's to use for sending and recieving SMS's maybe ?
Well.... Not yet.
This is my first ever .net VC++ program !!!!
There are lots of code snipets around but no full source code.
This is a work in progress project hence it is in the "Development and Hacking" fourm.
If you'd like to add some functionality to it......
I am asking because there seems to be a problem when trying to recieve SMS with SMS api as the HANDLE is already attributed to the messaging application (inbox/draft/outbox).
I believe you are using RAPI ? However i do not understand this API that well could u specify a bit more ?
Thanks for your help.
Hi nutitija,
I'm only using the RAPI function to pass parameters from my PC to the XDA. The actual sending of messages is done using the MAPI in the XDA.
My biggest problem is getting the subject/body and from fields to display correctly in the different XDA mail views.

Help Read SMS

Hello,
I would like to use SMS in a new application using XDA. I want my application can read sms in inbox.
Do you know how I could see example of source code using SMS API? Or do you have such example to help me?
I got example to send sms but cannot get sample how to read the sms.
FYI, i am writing program using eVB.
Thanks a lot
You should take a look at PocketPC Network Programming by Steve Makofsky or simply try
http://groups.google.com/groups?q=pocketpc+sms+api&start=0&hl=de&ie=UTF-8&
and
http://msdn.microsoft.com/library/en-us/dnppcgen/html/sms_apps2.asp?frame=true
SMS API is not easy.
Yup, it's not very easy, you need to learn about POOM...
I advise you to look into VB .net, it's been made a hell of a lot easier.
I still do it the Medieval way though! Win32 C++ all the way :shock:
V
I did include some C code on sending/reading SMS in this post
http://forum.xda-developers.com/viewtopic.php?t=10761&highlight=
You are asking about reading messages in the Inbox that is when poom as mentioned by vijay555 comes into play.
I don't know anything about poom, but I have read incoming SMS by making my read thread take control of incoming SMS. This means that the message never goes into the inbox.
vangelderp: interesting code, not seen it before on the board. A very good way to do it. It doesn't need to be installed before pocket outlook etc does it? I don't imagine it does. Good stuff!
V
No it does not need to be installed before PPC Inbox (Outlook), what seems to happen is when a SMS message comes in the Inbox fires up. From that point on my code won't get a handle to SMSRead.
So what you need to do is do a warm reset and then start your user program (including my code sample) before any new incoming SMS messages and then it will get the SMSRead handle first. This then blocks Inbox getting a handle which I am sure it raises a error message on if you then try to go into inbox.
vangelderp: yup, that's what I thought. I never used that technique because of that, I stuck with POOM. But your createevent and thread work is very helpful.
V
SmsReadMessage of SMS.API
Thanks for your all comments.
Do you know how to use SmsReadMessage of SMS.API ?
This function is used to Reads a previously received SMS message. I really hope somebody else out there can help me how to use that function
Regards
You use SmsReadMessage like I do in the code attachment I have mentioned.
This function does not read a SMS message that has already been received by the normal PPC Inbox program. As said for that you need to use POOM.
SmsReadMessage for for your code to get a SMS Read Handle and then wait for the event (The Message) to occur and then use the SmsReadMessage function.
Exactly as I have done in my code snippit.

Contacts Arrangement

When i save a contact with name and surname it appears on my contact list like this: Surname, Name (ex: Gates, Bill), can i change this so that the name is displayed first?(ex: Bill Gates).
Furthermore, can i disable the default format by which phone numbers are saved? By default when i add a phone number to a contact it appears like this (xxx) xxx-xxxx. Not that i have a problem with this BUT when i transfered some contacts from my p910 i found out that they were saved like xxxxxxxxxx. So what, you may think...well actually when a message delivery report arrives (and the contact is not saved with the "default phone format"), next to the phone number(in the delivery report) shows the name of the contact, something that is very usefull when -for example- multiple messages are sent or when a message is delivered 2-3 days later.
ps: actually, what i really need is not neccesarily to change the default phone format but to find out a way to see in the message delivery report the name of the contact that the message was delivered to.
ps2:sorry for the huge post!
thanx in advance
I had the same problem 2 years ago, and found out that it is impossible to let the PPC display the name as "Firstname Surname". So I "solved" it by saving the full name of the contact under Firstname. I know it isn't a solution but I couldn't get it to display it how I wanted it.
yeah, i did the same thing, but as you said it isn't a solution
Your problem here then is to hack the deilvery report, not Poutlook.
V
vijay555 said:
Your problem here then is to hack the deilvery report, not Poutlook.
V
Click to expand...
Click to collapse
what matters is to achieve the goal and not how it will be achieved
True, but "Every Journey Begins With a Single Step, Minus Your Shoes".
Knowing what to hack and what not to hack is your first step. Poutlook, I believe, stores the contact data in whatever format it is happy with. You can't change that - you can change the external display of that data through the File As field, but that's subject to the app you are using using that field and not the underlying data stored in Poutlook.
So, if you wish to force the message delivery report into using the fields as you want them, hack that. Poutlook can't be easily hacked and is not your problem. So research hacking the delivery report, and/or learn to hack it yourself to force custom output.
V
thanx vijay555, i found this Name of recipient in SMS delivery receipt on WM5 and i guess this is what i was looking for
this really is very simple (assuming you sync with outlook on your pc).
In your contacts in outlook, double click a contact and in the "file as" drop down change it to "firstname lastname". then sync with your device and hey presto, all will be as you want!
bit of a pain in the arse if you've got 5billion contacts, but hey!
yeah, i discovered it yesterday, thanx anyway, but as you said its a pain...
I don't get it. If you're going to use File As, just use FileasFL to do the conversion automatically on your PPC.
V

SMS Listener : phone is saving all incoming SMS txt in built in folder

Was going through my Tmobile HD2 and found a folder called SMS Listener under My Device/Temp . When I opened it , there was every txt I had received since I had purchased the phone . I have not done any master resets since date of purchase. Honestly this was kinda scary . There was alot of incriminating txt . Is there a way to prevent this?
bump......
Is this a US t mobile HD2 your referring to?
I'd imagine theres a reg entry you could change but I have never encountered this before......
Hmmm....
can't find any such folder on my UK HD2. Must be a tmous thing.
I found it in the registry did a search on the net . It is some home connected to SMS wakes up the phone when there is an incoming txt. But why is it saving it to the main memory in the phone using Word mobile word document .docx. How can this be disabled without turning off sms. ?
\HKCR\CLSID\{54F38CD4-B778-28BA-6F63-2D942AFCCD7D}InProcServer32\windows\SmsListener.dll
Is this related to the Patriot act or something?
its been discussed and here is a way to "turn off the sms logger / listener"
http://forum.xda-developers.com/showthread.php?t=660101 (page 2, post # 11, provided by member vponomarev )
and...
http://forum.xda-developers.com/showthread.php?t=690265
i also found this simslistener on my hd 2 iwould like to know what is its purpose
all my text are there for anyone to see
private thing
anyone have an answer ?
this is true, I backup my sms with that file SmsListener_log.txt

Categories

Resources