共用方式為


Quick Messaging API (MAPI) Sample

I heard someone say they wished it were possible to create a speed dial entry for text messaging in Windows Mobile. As most of you might know, text messaging is not a standalone app - it's just another account within the Messaging client, which also supports Outlook and other email accounts (Hotmail, POP3 etc).

So how do you create a speed dial entry that always goes directly into Text Messages (and not any of the other types of messaging accounts?)

I decided to write a tiny app that does this. My first thought was to launch a command line like Inbox.exe with some special parameter that would force it into the Text Messages account. The downside of doing something like that is the .exe name/path might change in the future and the command line parameter is probably undocumented.

I then remembered reading about some APIs that let you interact with the messaging client. I found one that did exactly what I needed: MailSwitchToAccount.

Sweet! With this documented API, the task becomes very easy and immune from breaking in future versions of Windows Mobile. The entire program is as follows:

#include <windows.h>
#include <cemapi.h>

int WINAPI WinMain(HINSTANCE hInstance,
                   HINSTANCE hPrevInstance,
                   LPTSTR    lpCmdLine,
                   int       nCmdShow)
{
    MailSwitchToAccount(_T("SMS"), MCF_ACCOUNT_IS_NAME);
    return 0;
}

As you can see, it is very easy to write an app that launches a specific account within the Messaging app. The user can then create a shortcut to this app and launch it from speed dial or the Start menu. For more MAPI functions that might be useful to you, click here. (Note: you will need to link with cemapi.lib to use these functions).

-Mel Sampat

Comments

  • Anonymous
    October 02, 2007
    PingBack from http://www.artofbam.com/wordpress/?p=4773

  • Anonymous
    October 08, 2007
    please help me i have one mio A501 with windows mobile 5.0 i have one problem my windows language is france , please help to change this language to english. thanks my email is ali_1360@yahoo.com

  • Anonymous
    October 08, 2007
    I can send/receive text MMS, but I cannot include MMS attachments like images, vdo and snd files. I already do the same things on another smartphone platform, but have not yet resolved this problem in Windows Mobile. Please help with some sample code. email me: jeans0039@gmail.com

  • Anonymous
    October 18, 2007
    I am writing a mobile app (currently testing on 5.0) that needs to maintain a persistent reference to a message.  I've used MAPI to obtain the PR_ENTRYID of both the message store and of the message.  The problem I encounter, is I can't later directly use these ID's with OpenEntry().  Doing so, crashes in cemapi.dll.  However, I can request a table of message stores, iterate through the list and compare each entry's PR_ENTRYID with the PR_ENTRYID I perviously obtained (using CompareEntryIDs()) and find the correct Message Store.  I can then iterate through all of it's folders and subfolder looking for a message whose PR_ENTRYID compares the same (again using CompareEntryIDs()).  This is NOT an optimal solution.  Is the OpenEntry() crash a known problem, or am I perhaps doing something wrong?   By the way, I can use the saved PR_ENTRYID for the message and call MailDisplayMessage() and it quickly displays the correct message!!!  It doesn't even need the PR_ENTRYID of for the storage!!!.  Is there a way to do something equivalent that gives me a way to request properties for the referenced email? I would appreciate any help. Thanks.

  • Anonymous
    November 21, 2007
    I know this is not the correct article to be asking this in but I can not find any other's that are current. I am looking for some help in using the apis for Wap protocal and push messages. I am looking to implement the PushRouter(apis) and  have looked at the 'fileclient' example that ships with the Windows Mobile 6 SDK but the sample falls short of how to implment or at least test the PushRouter_GetMessage section. If there is anyone that can point me to the correct forum/person/article that would be more helpful I would appreciate it. Thanks for reading this.

  • Anonymous
    November 27, 2007
    are there APIs for sending and receiving MMS messages?

  • Anonymous
    December 23, 2007
    The comment has been removed

  • Anonymous
    December 27, 2007
    hi man where r u , iam wait for u now to internet , please harry up.

  • Anonymous
    March 22, 2008
    Can somebody post the .exe or .cab for the program shown above? Also, it would be great of somebody could whip up an additional version that directly opened GMail (vs text messaging). Thanks in advance.

  • Anonymous
    March 29, 2008
    Hi, I'm trying to make an app that automatically sets up a specific email service.  My app is similar to the "Setup Up Email" app that ships with WM which allows you to quickly setup for example a Yahoo! email account, and when it does, it sets up a Yahoo! icon that shows in the in the mail accounts page. I'm trying to find out how to put my own icon for my mail service the same way that that app does it for Yahoo! and MSN mail - Anyone knows where this icon is or how to replace it with my own? Thanks!

  • Anonymous
    April 26, 2008
    please help me i have one mio A501 with windows mobile 5.0 i have one problem my windows language is Greece , please help to change this language to english. thanks my email is akorda@abv.bg

  • Anonymous
    June 28, 2008
    please help me i have one mio A501 with windows mobile 5.0 i have one problem my windows language is greece, please help to change this language to english. thanks formatpsih@yahoo.com

  • Anonymous
    October 29, 2008
    please please please help me i have one mio A501 with windows mobile 5.0 i have one problem my windows language is greece, please help to change this language to english. thanks rc-_-dj@hotmail.com

  • Anonymous
    December 15, 2008
    Help me, I can't find API Send MMS on windows mobile, Please tell me how to programming send MMS on Windows Mobile. Thanks my mail ducnt.cc@gmail.com

  • Anonymous
    June 15, 2009
    please how to change my mio a501 language from greek to english