您的位置:首页 > 其它

为什么不能用iDescription?

2009-03-20 16:06 176 查看
最近做监听短消息,提取文本的一个功能。出了一件怪事:用于提取短信内容的iDescription怎么也不能将文本完整的获得,只能读取一部分的内容。

TPtrC description(iMsvEntry->ChildDataL(iNewMessageId).iDescription);//打印出的内容总是只有一部分。




没办法,只好用这种获取短消息内容的方法:



iMsvEntry->SetEntryL(iNewMessageId);
     // Open the store, read-only
     CMsvStore* store = iMsvEntry->ReadStoreL();
     CleanupStack::PushL(store);
     if (store->HasBodyTextL())
      {
      CParaFormatLayer* iParaFormatLayer =
        CParaFormatLayer::NewL();
      CCharFormatLayer* iCharFormatLayer =
        CCharFormatLayer::NewL();
      CRichText* richText = CRichText::NewL(iParaFormatLayer,
        iCharFormatLayer);
      CleanupStack::PushL(richText);
      store->RestoreBodyTextL(*richText);
      const TInt length = richText->DocumentLength();
      TBuf<128> buf(0);
      richText->Extract(buf);//这样子,才能完整的读取。是什么原因呢?
      CleanupStack::PopAndDestroy(richText);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: