symbian mtm操作
2010-08-20 01:50:00 来源:WEB开发网CMsvEntry* entry = CMsvEntry::NewL(*iSession,KMsvGlobalOutBoxIndexEntryId,sort);
CleanupStack::PushL(entry);
//选择全部内容
CMsvEntrySelection* entries = entry->ChildrenL();
CleanupStack::PushL(entries);
//读取消息索引信息,At(0)代表首信息,取其他的可以给出相应的index
TMsvId aEntryId = entries->At(0);
//得到消息索引的时间
TTime time;
time = entry->ChildDataL(aEntryId).iDate;
iSmsMtm->SwitchCurrentEntryL(aEntryId);//iSmsMtm是CSmsClientMtm类型的指针变量,它已经初始化
iSmsMtm->LoadMessageL(); // load the message
CRichText& body = iSmsMtm->Body(); //sms的内容存到CRichText控件对象中
TPtrC msg(body.Read(0));
//弹出对话框,提示短信内容
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(msg);
CleanupStack::PopAndDestroy();
2.删除消息条目
//删除草稿箱中的消息条目
TMsvSelectionOrdering sort;
sort.SetShowInvisibleEntries(ETrue);
CMsvEntry* entry = CMsvEntry::NewL(*iSession,KMsvDraftEntryId,sort);
CleanupStack::PushL(entry);
CMsvEntrySelection* entries = entry->ChildrenL();
CleanupStack::PushL(entries);
TInt i = entries->Count();
for(TInt ncount=0;ncount< p>
{
entry->DeleteL(entries->At(ncount));
}
// information to the user
iEikonEnv->InfoMsg(_L("DeleteAll Done!"));
CleanupStack::PopAndDestroy(2);
3.创建消息条目
创建消息条目部分在收件箱和草稿箱两个地方是不一样的,具体代码如下:
//在草稿箱中创建短信
const TInt LEN = 12;
//转入收件箱
iSmsMtm->SwitchCurrentEntryL(KMsvDraftEntryId);
更多精彩
赞助商链接