I'll create a wappush sms in the inbox,and i could create the general sms successful with the following code:
void CSmsMonitorEngine::CreateNewMessageL(const TDesC& aAddr, const TDesC& aContent)
{
const TInt LEN = 12;
//================================================================
//
//================================================================
iSmsMtm->SwitchCurrentEntryL(KMsvGlobalInBoxIndexEntryId); //test!
TMsvEntry newIndexEntry;
newIndexEntry.iDate.HomeTime();
//
newIndexEntry.SetInPreparation(ETrue);
// This is an SMS message
newIndexEntry.iMtm = KUidMsgTypeSMS;
newIndexEntry.iType = KUidMsvMessageEntry;
newIndexEntry.iDetails.Set(aAddr);
newIndexEntry.iDescription.Set(aContent.Left(LEN));
newIndexEntry.SetSendingState(KMsvSendStateNotApplicable);
newIndexEntry.SetUnread(ETrue);
newIndexEntry.SetNew(ETrue);
//in 3rd edition crashes here if capabilities are wrong
newIndexEntry.iServiceId = iSmsMtm->ServiceId();
//pID = (TInt*)&newIndexEntry;
//*(pID+2) = 0x120021;
iSmsMtm->Entry().CreateL(newIndexEntry);
TMsvId smsId = newIndexEntry.Id();
iSmsMtm->SwitchCurrentEntryL(smsId);
iSmsMtm->Entry().ChangeL(newIndexEntry);
iSmsMtm->SaveMessageL();
/*--------------------------------------------
// header
//------------------------------------------*/
CRichText* richText = CRichText::NewL(CEikonEnv::Static()->SystemParaFormatLayerL(), CEikonEnv::Static()->SystemCharFormatLayerL());
CleanupStack::PushL(richText);
richText->InsertL(0, aContent);
CSmsHeader* mySmsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver,*richText);
CleanupStack::PushL(mySmsHeader);
CMsvEntry* tmpEntry = iMsvSession->GetEntryL(newIndexEntry.Id());
CleanupStack::PushL(tmpEntry);
if ( tmpEntry->HasStoreL() )
{
mySmsHeader->SetFromAddressL(aAddr);
CMsvStore* store = tmpEntry->EditStoreL();
CleanupStack::PushL(store);
//
CSmsDeliver& deliver = mySmsHeader->Deliver();
TTime nowTime;
nowTime.HomeTime();
deliver.SetServiceCenterTimeStamp(nowTime);
mySmsHeader->StoreL(*store);
store->StoreBodyTextL(*richText);
store->CommitL();
CleanupStack::PopAndDestroy(store);
}
TMsvEntry tttEntry = iSmsMtm->Entry().Entry();
//
tttEntry.SetInPreparation(EFalse);
//
tttEntry.SetReadOnly(ETrue);
iSmsMtm->Entry().ChangeL(tttEntry);
CleanupStack::PopAndDestroy(3, richText); // tmpEntry, mySmsHeader, richText
//delete iSmsMtm;
//iSmsMtm = NULL;
//delete iMtmRegistry;
//iMtmRegistry = NULL;
//delete iMsvSession;
//iMsvSession = NULL;
return;
}
then i change the line "newIndexEntry.iMtm = KUidMsgTypeSMS;" to "newIndexEntry.iMtm = KUidMtmWapPush;",then the program could create a sms in inbox(looks like a wappush in the list), but when i open it ,it crashed,and prompt an error with "PushMtmUI 14",i don't know what dose it mean,could anybody could help me?



