MAPI and MMS - General Questions and Answers

Hi all,
I'm working on an Windows Mobile application that requires me to make use of MAPI to programatically send MMSes (with an image file attached) from one device to another.
I've mainly used the "Sendmail" sample codes provided with Visual Studio 2005 as a reference point:
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\Sendmail\ SendMail.sln
A similar program source (by someone else) can be found here:
http://www.mombu.com/microsoft/pocket-pc-phone-edition/t-send-mms-using-mapi-on-smartphone-221671.html
My own modifications to the code (tested on a Dopod 810) include setting PR_MESSAGE_CLASS property tag to IPM.MMS1 (This ensures the use of the proper MMS compose form that is found in tmail)
I'm having quite a lot of trouble trying to attach a JPG file to the MMS. To date, 2 main problems exist
1. JPG image is not being "attached" to the message (received SMS has no message objects, other than the subject line).
2. Message body is not shown, even if written to stream.
What could be a possible cause here? The sample source codes do not actually reference proper files, so I was wondering if I might have missed setting other property tags. Just hoping to find someone who has had some experience in integration MMSes and MAPI. Some sample source code would definitely be of help too
Thanks in advance.

Related

Windows Mobile 5.0 Direct Push AND timed-sync simultaneously

First, I am new to this forum and apologize if this is posted to the wrong topic.
Does anybody know of a way (either native setting/registry tweak or 3rd party app) that allows you to set up a timed activesync while also using the Direct Push technology? In my tests on my Cingular 8125 (upgraded to newer ROM than factory) I use Direct Push and it is WONDERFUL with the exception that it seems only the "inbox" folder is pushed. I use rules on Exchange that sort certain items into other folders. Although they sync when i manually start an activesync, they do not update through Direct Push. These items are not as important as my Inbox, but it would be nice if, say, the device could do an ActiveSync every hour or so. However, if I put the ActiveSync schedule to anything other than "As new items arrive" the Direct Push becomes disabled.
This cannot be very hard to code, because from my research there are new APIs available, specifically ActiveSyncStart and ActiveSyncStop in activesync.h which start and stop activesync manually from a 3rd party app. However, they are only available in Unmanaged code (ie, C++) and my Visual Studio only has VB.NET and I cannot figure out for the life of me any way to marshall those functions.
Anybody know of a little 3rd party app that can initiate activesyncs on a timed schedule while having DirectPush enabled? Or is anybody with VC++ and Mobile SDK up to writing one?
Solution
I figured out the solution to this problem (in case anybody is interested).
The documentation at MSDN appears to reference the wrong library (i can't even find an 'actsyncc' which is what is in the MSDN article). The DotNet P/Invoke for VB.Net should be...
Private Declare Function ActiveSyncStart Lib "aygshell.dll" () As Integer
Private Declare Function ActiveSyncStop Lib "aygshell.dll" () As Integer
From there, it's as simple as just creating a timer that fires up "ActiveSyncStart"
I may not know unmanaged C++, but I know my VB.Net.

[Question] Compressed SMS Source Code? App?

I currently have been trying to implement an application that supports advanced SMS features like compression (as spelled out in specification "Compression algorithm for text messaging services (Release 8)", 3GPP TS 23.042 V8.0.0). A quick search of the forum did not result in anything that supports this, so forgive me if this is a repeat.
Does anybody have an implementation of this specification that actually works? I would very much like to see the source code if so, but an application that I could compress an SMS using that protocol would be nice as well just to compare to what I am generating.
The problem is I have the GSM 7bit huffman tree, and it works fine for me, but it does not produce results that match the test vectors included with the specification above.
Any help would be greatly appreciated!
I did find an implementation that CLAIMS to be compliant, but I have to work through de-compilation of it... JAVA Class files... Also working up a driver for it to test out it's compression. If I can successfully de-compile the class files, and the driver works, then I might be done (short of converting it to C/C++). I'll post later on the success /failure of it.
Oh, it's called "Attention" and the JAR files are available at:
http://code.google.com/p/attention/
Got the SVN source tree for it (was added recently) and this is truly not ready for prime time. It is RIDDLED with errors and absolute paths' to files that don't exist as anything other than resources... I have tried going through and fixing most of them that has to do with the compression, but my hopes are not high. Plus, it's in JAVA...
Anyhow, I am still looking for a GOOD implementation of this. Any suggestions would be greatly appreciated.

Possible to use "Save" method in a local .htm file to save XML updates?

I am researching the possibility of using MSXML to update XML records on Windows CE devices using only pocket internet explorer. I was able to open and edit XML files using a local web page, but could not successfully save the results of an update. I tried the "save" method of a ActiveXObject("Microsoft.XMLDom") object. This works fine on a PC as long as I save the webpage with the .hta extension, but results in a Permission Denied error when I save the web page with the .htm/.html extension. Win CE doesn't seem to support the .hta extension.
The two biggest restrictions for my project are:
1) Cannot "install" software (.cab,.exe) on the devices due to security policy and
2) There is no data connectivity on the devices.
So my questions are, "Is it possible to save a file using javascript inside a local web page on a Win CE/Windows Mobile device? If so, how?" The file happens to be XML, but the solution need not involve only XML objects as I can readily access the content as plain text.
My best guess is that it is not possible without some sort of windows CE equivalent of the pc .hta file. Anyone? I appreciate any hints/comments that can help.
Thanks,
Dan

[Q] Send picture from PC to WP7

The data can be sent as a simple byte stream.
I want to capture a PC screen and send it to WP7, I must convert it in server side and reconvert it in client side (I don't know how do that).
The code that I developed to capture the PC screen give me a bmp image extension, and the WP7 can't read that file.
How do I serialize media objects (pictures) for socket transfer??
I want to be able to send pictures files from Pc to WP7 via WiFi using socket.
How can I convert the picture file to what the file extension stream and send it?
I am confused how to do that
juste_3al_faza said:
The data can be sent as a simple byte stream.
I want to capture a PC screen and send it to WP7, I must convert it in server side and reconvert it in client side (I don't know how do that).
The code that I developed to capture the PC screen give me a bmp image extension, and the WP7 can't read that file.
How do I serialize media objects (pictures) for socket transfer??
I want to be able to send pictures files from Pc to WP7 via WiFi using socket.
How can I convert the picture file to what the file extension stream and send it?
I am confused how to do that
Click to expand...
Click to collapse
I think I need to know a little more about what you are trying to do.
I am assuming a program is running on the PC. You want to capture an image of the program. Then send it to the phone through WiFi.
For it to be readable on the phone, bmp will not work. Convert it to jpg. Plenty of free algorithms and libraries can be can be found to do this.
To transfer it to the phone, I would suggest using a webserver or hosting one on the same machine. Possibly Apache, since it is free, but i am more familier with IIS.
Have your app on the pc do a post to page on localhost. Have it pass something on the querystring to identify the phone it is for. This page will store the image in a location on your computer that the webserver has access to.
Now your phone will need an app that will also hit that same ip address, not local host. You will need to know the ip address of the machine. Have it hit a different page and pass that phone identifier. The page will do a redirect to the jpg file. As you recieve the output, write it to to a file on the phone. Using Redirect should automatically send the name and mimetype with the response.
There are other more complicated ways to stream an image, but this is the simplest.
You could always have the webserver be on a different machine entirely, which would make it more generic. Yiou could even have it be hosted so it is accessible from the internet, not just the intranet.
Usign a webserver seems vastly over-complicated to me, but OK. Maybe I'm just more comfortable writing netwrok code than most people...
Take your screenshot (I assume you already managed this). Put it in a format the phone likes (JPEG is good; there might even be BMP-to-JPEG conversion code in the .NET library). Connect the phone and the PC.
This is where the network code comes in. I would personally do this by starting a TCP server socket on the PC on some arbitrary high port, more than 1024 and less than 65000. Have it "Listen()" for a request from the phone. Write a phone app that opens a TCP connection to the PC on that port. Once the phone connects, set it waiting to Receive() data. On the PC side, since some signal that you're going to transfer a file (a realllllly simple protocol would be to just send the file size, as an int, first). There are a few ways to send data on a TCP socket; you can use the Send() function which takes an array (type byte[], which could be populated by using another array and then converting), or a NetworkStream, which is just like any other member of System.IO.Stream (I'm assuming you're writing both ends in .NET, although really simple netcode is actually easier in C). To transfer the file itself, just open it and read it however you like, and send the byte array over the socket. On the phone end, create a new IsolatedStorage file, and write the data coming over the socket into it. Just read in a loop until you've read up to the size that the server told you was coming, or until you hit the end of the stream / the connection closes (which indicates a bug or a problem on the other end).
That's a dead-simple and not very robust network protocol, but it does have the advantage of being trivial to code up...
Or, if that all sounds too confusing, you can try using HTTP. I actually find that to be *more* painful, but YMMV; I cut my first netcode in C and to me HTTP feels needlessly complex by comparison (because it's meant to do so many more things than just transfer a simple byte stream like a file). If you want to look at the source code of an app that uses HTTP to send and receive files, including both the phone app and the PC server app, take a look at WP7 Advanced Explorer (it's on Codeplex). Ignore the parts about filesystem and registry for now, and just look at the network part.
To me the web server approach may seem to be the easiest solution because I have been doing dot net web programming since before dot net 1.1 came out (beta 1.0). Before that I was doing other web development using classic asp, xml, xsl, and javascript. So, I have been working with IIS for well over a decade.
Quite recently, I just worked on dot net code to stream documents and video that is not directly accessible through any virtual directory, without doing a redirect for the purpose of enforcing additional security.
Different types of programmers find different things easier. I have done little to no direct sockets programming since college, so that to me would be more difficult, even if it is actually easier.
It didn't even occur to me to try listening on a port.
Also, now that you mention it, there are ways built into dot net to convert image types. I actually use them in some of the programs I've written for Windows Mobile, such as the FB pic to Outlook Pic application. I might be converting the other way in that app though.
I don't think I do that with web service
I prefer to use the Socket.
My apps let me just view the PC screen
juste_3al_faza said:
The data can be sent as a simple byte stream.
I want to capture a PC screen and send it to WP7, I must convert it in server side and reconvert it in client side (I don't know how do that).
The code that I developed to capture the PC screen give me a bmp image extension, and the WP7 can't read that file.
How do I serialize media objects (pictures) for socket transfer??
I want to be able to send pictures files from Pc to WP7 via WiFi using socket.
How can I convert the picture file to what the file extension stream and send it?
I am confused how to do that
Click to expand...
Click to collapse
With the zune.

[Q] how execute/apply xml file?

Hello,
I have a lot of problems with omnia 7 due to app profile network of samsung haven´t got the profile of my operator. I can set it thanks to a post of here, but I think that it is a bit difficult and you need the computer to set it. As I have studied some of programming c#, I decided to make an app that set mms and internet. I have already done the screen and I´ve get to make that app create the file xml with the code in order to set mms and internet, but I haven´t found information about how execute/apply the file xml with the app. Where can I find about it?
PD: Sorry, I do not control English very well
Hi,
I guess it's a topic a bit complex, but can not someone help me with this?
You use an OEM COM interface, accessed from C# by using Microsoft.Phone.InteropServices.ComBridge. One easy way to see how this is done is to look at the source of an app that does it. If you can't get the source to DiagProvXML, you could always just decompile it (decompiling .NET code is pretty easy and there are several tools that can do it). There are several other apps that also use provxml; one or more of them may offer source access.
Hi,
Thank for your help and I can select the services that I have load, but I have a small problem that I hadn't taken into account. I know c# but my apps are a lot of more easy that diagprovxml, and I can´t find the part of program that I´m interested. I use "JustDecompile" to decompile the app. Could you tell me what class(or classes) is (are) what I'm looking for?
Thank you very much again
Hmm... it's not linked in my SIG because it's out-o-date, but you could try using Search to find my old DeployProvXml app. It includes a pretty straightforward example of using provxml.
Essentially, you need the following things:
The interopservices DLL (allows you to use the ComBridge class).
The OEM DLLs (DMXMLCOM.dll and such).
COM class and interface definitions for them in C# (this is the stuff with the [ComImport] attributes and the GUIDs).
ID_CAP_INTEROPSERVICES in your WMAppManifest.
WPInteropManifest.xml file in your project.
Use the ComBridge to register the COM interfaces, then create an instance of the COM class(es), cast to the appropriate interface type(s), and use a variable of the interface type like any other .NET object.
You can read a bit more about COM and native code in Heathcliff74's guide. It's aimed at making your own native libraries, so skip all the stuff about creating your own COM classes and writing native code. http://forum.xda-developers.com/showthread.php?t=1299134
Hi again, Does the method WP7RootToolsSDK.Environment.ProcessConfigXml allow to set the parameters that have a tipical xml file?
thank you again
I'm not sure what you mean by "set the parameters" but the Root Tools SDK does in fact allow you to consume ProvXML files now (I think it even supports the query provXML and returns the output, though I haven't tried).

Categories

Resources