Symbian createandsendmessagel sends MMS 1
You can use a program to call the MMS edit box to make the MMS happen. It is usually used for friend recommendation.
The Program sets up the color edit box, inserts the corresponding content, and sets the focus to the input number.
Allows users to set numbers to send messages.
Let's see how to implement
Void csendmmstestappui: createandsendmessagel (const tdesc & descontent)
{
// Create empty message
Cmessagedata * message = cmessagedata: newlc ();
Cparaformatlayer * paraformatlayer = cparaformatlayer: newl ();
Cleanupstack: pushl (paraformatlayer );
Ccharformatlayer * charformatlayer = ccharformatlayer: newl ();
Cleanupstack: pushl (charformatlayer );
Crichtext * messagebodycontent = crichtext: newl (paraformatlayer,
Charformatlayer );
Cleanupstack: pushl (messagebodycontent );
Messagebodycontent-> insertl (0, descontent );
Message-> setbodytextl (messagebodycontent );
// Start message editor through sendui
Sendappui-> createandsendmessagel (ksenduimtmsmsuid, message, knulluid );
Cleanupstack: popanddestroy (4 );
}
The above code passes the test on n73, N95, and e71.
Symbian MTM sends MMS 2
In the previous blog, I introduced sending MMS via an editing box, but in some cases we may need
Send text messages in the dark, that is, to make users unaware. How can this problem be achieved?
Let's take a look at the following implementation scheme
Void cmssender: sendmmsl (const tdesc & aaddress, const tdesc & acontent)
{
Cmsventry * entry = cmsventry: newl (* isession, kmsvglobaloutboxindexentryid
, Tmsvselectionordering ());
Cleanupstack: pushl (entry );
// Set context to the parent folder (outbox)
Immsmtm-> switchcurrententryl (Entry-> entryid ());
// Create new message in the parent folder (outbox) and
// Set it as the current context
Immsmtm-> createmessagel (immsmtm-> defaultservicel ());
Cleanupstack: popanddestroy (); // entry
// Set the mobile phone number and the sent mobile phone number
Immsmtm-> addaddresseel (aaddress );
// Sends the title of the MMS Message.
// Setting Message Subject
Immsmtm-> setsubjectl (_ L ("/x597d/x53cb/x63a8/x8350/x4e50/x79c0 "));
// Opening store
Cmsvstore * store = immsmtm-> entry (). editstorel ();
Cleanupstack: pushl (store );
_ Partition (kfilename, "mmsexample.txt ");
Tmsvattachmentid attachid = kmsvnullindexentryid;
// Create an attachment of the text type. You can also publish an attachment of the image music type by using MMs.
Immsmtm-> createtextattachmentl (* store, attachid, acontent, kfilename );
Store-> commitl ();
Cleanupstack: popanddestroy (); // store
Tmsventry ent = immsmtm-> entry (). Entry ();
// Set inpreparation to false
Ent. setinpreparation (efalse );
// Mark as visible, after this message can be seen in outbox and,
// After sending, In sent folder.
Ent. setvisible (etrue );
Immsmtm-> entry (). changel (ENT); // Commit Changes
// Save the changes
Immsmtm-> savemessagel ();
// Start sending the message via the server MTM to the MMS server
Cmsvoperationwait * Wait = cmsvoperationwait: newlc ();
Wait-> istatus = krequestpending;
Cmsvoperation * op = NULL;
// Send information
OP = immsmtm-> sendl (wait-> istatus );
Wait-> Start ();
Cleanupstack: pushl (OP );
Cactivescheduler: Start ();
// The following is to ignore the completion of other active objects.
// It is not needed if the app has a command absorbing control (using
Ccommandabsorbingcontrol ).
While (wait-> istatus = krequestpending)
Cactivescheduler: Start ();
Cleanupstack: popanddestroy (2); // op, wait
}