WEB开发网
开发学院手机开发Symbian 开发 Symbian (Read Inbox)读取收件箱的内容 阅读

Symbian (Read Inbox)读取收件箱的内容

 2010-02-21 15:53:00 来源:WEB开发网   
核心提示:{//以下演示了如何取出附件中的SIS文件TFileName newPath(_L("c:\data\"));newPath.Append(attachment->AttachmentName());TInt find1 = newPath.FindF(_L(".sis")

{

//以下演示了如何取出附件中的SIS文件

TFileName newPath(_L("c:\data\"));

newPath.Append(attachment->AttachmentName());

TInt find1 = newPath.FindF(_L(".sis"));

TInt find2 = newPath.FindF(_L(".sisx"));

TBuf<128> aTarget;

aTarget.Copy(_L("c:\data\back.sis"));

if( find1 != -1 || find2 != -1)

{

RFile file = attachManager.GetAttachmentFileL(i);//注意这里需要共享文件句柄取出数据.

//彩信都保存在私有目录,在3RD上没有权限读写.

//不过好消息是第二版可以直接搞定.嘎嘎!!

TInt size(0);

file.Size(size);

HBufC8 *buf = HBufC8::NewLC(size);

TPtr8 ptrBuf(buf->Des());

file.Read(ptrBuf, size);

RFile newFile;

User::LeaveIfError(newFile.Replace(fs, aTarget, EFileWrite));

newFile.Write(ptrBuf);

newFile.Close();

CleanupStack::PopAndDestroy(buf);

}

}

}

fs.Close();

}

else if(entry->Entry().iMtm == KUidMsgTypeBt)//BlueTooth

{

RLog::LogPoor(_L("bt message"));

//原理和彩信一样,不用多说了.直接上代码!!!

CBaseMtm* clientMtm = iMtmRegistry->NewMtmL(KUidMsgTypeBt);

CleanupStack::PushL(clientMtm);

clientMtm->SwitchCurrentEntryL(entryID);

clientMtm->LoadMessageL();

CMsvEntrySelection* btChildren = entry->ChildrenL();

CleanupStack::PushL(btChildren);

TInt len = btChildren->Count();

RLog::LogPoor(_L("len = "),len);

if (btChildren->Count()>0)

{

TMsvId btAtt = (*btChildren)[0];

entry->SetEntryL(btAtt); // switch context to CHILD entry

if (entry->HasStoreL())

{

CMsvStore* inboxStore = entry->ReadStoreL();

CleanupStack::PushL(inboxStore);

上一页  1 2 3 4 5  下一页

Tags:Symbian Read Inbox

编辑录入:coldstar [复制链接] [打 印]
赞助商链接