Categories: Symbian C++ | Lang-CN | How To | SMS | Code Examples
This page was last modified 16:27, 23 June 2008.
How to create a SMS with attachment in inbox
From Forum Nokia Wiki
CMsvSession* messageSession; CClientMtmRegistry* registry; TFileName details; TFileName description; TFileName fileName; TEntryInfoHolder infoHolder; messageSession = CMsvSession::OpenSyncL(*this); CleanupStack::PushL(messageSession); registry = CClientMtmRegistry::NewL( *messageSession ); CleanupStack::PushL( registry ); infoHolder.messageSession = messageSession; infoHolder.iEntryId = 0; // No entry yet ! CleanupStack::PushL( TCleanupItem( DeleteEntry, &infoHolder ) ); // Subject _LIT(KSub, "InterGrafx"); details.Copy( KSub() ); // Description description.Copy( igpFileName ); // Get message inbox CMsvEntry* inbox=messageSession->GetEntryL( KMsvGlobalInBoxIndexEntryIdValue ); CleanupStack::PushL( inbox ); TMsvEntry newEntry; // Child entry of inbox // TMsvEntry
#ifdef __UIQV21__ newEntry.iMtm = TUid::Uid( KUidMsgTypeBT ); #endif #ifdef __S60V12__ newEntry.iMtm = TUid::Uid( KUidMsgTypeBt ); #endif // #ifdef __S60V22__ newEntry.iMtm = TUid::Uid( KUidMsgTypeBt.iUid ); #endif //__S60V22__ newEntry.SetVisible( EFalse ); newEntry.SetInPreparation( ETrue ); newEntry.iType = KUidMsvMessageEntry; newEntry.iServiceId = KMsvUnknownServiceIndexEntryId; newEntry.iDate.HomeTime(); newEntry.iSize = 120553;//todo newEntry.iDetails.Set( details ); newEntry.iDescription.Set( description ); // For bio // For future usage //newEntry.iBioType = 0x101F3CD9; //newEntry.iMtmData3 = 1; //KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated; // this defines MT message //newEntry.iMtmData1 = 0; //newEntry.iMtmData2 = 0; //TUid aTypeUid; //aTypeUid.iUid = 0x10000F6A; //newEntry.iType = aTypeUid; //TUid aMtmUid; //aMtmUid.iUid = 0x10001262; //newEntry.iMtm = aMtmUid; inbox->CreateL(newEntry); infoHolder.iEntryId=newEntry.Id(); CClientMtmRegistry* mtmReg = CClientMtmRegistry::NewL( *messageSession ); CleanupStack::PushL( mtmReg ); // Child entry of inbox // CMsvEntry CMsvEntry* entry = messageSession->GetEntryL( newEntry.Id() ); CleanupStack::PushL( entry ); CBaseMtm *mtm = mtmReg->NewMtmL( entry->Entry().iMtm ); // takes ownership // The attachment will belong to it mtm->SetCurrentEntryL( entry ); CleanupStack::Pop(); // entry CleanupStack::PushL( mtm ); // Create an empty attachment // On return, we get values of attachmentId, tempfileName TFileName tempfileName; TMsvId attachmentId; mtm->CreateAttachmentL( attachmentId, tempfileName ); // Construct the path of the file to be created as attachment HBufC* completeFilePath = HBufC::NewLC( 500 ); TPtr completeFilePathPtr = completeFilePath->Des(); completeFilePathPtr.Append( tempfileName ); completeFilePathPtr.Append( description );
Links
- Code snippets are taken from http://www.devdiv.net/topic.asp?TOPIC_ID=118
我按照这个http://www.symbian.com/developer/techlib/v9.2docs/doc_source/faqsdk/faq_1151.html 做的BT短信,带附件。但是在6630上不好用呀。只有7650好用
Best regards http://www.devdiv.net
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sms socket help | kornhed | Symbian Networking & Messaging | 2 | 2004-06-25 09:15 |
| 急盼高手帮忙解决问题!接收短信方面 | zhaoguiyu | Other Programming Discussion 关于其他编程技术的讨论 | 15 | 2004-10-19 07:12 |
| Sms inbox password | GSW | General Messaging | 2 | 2007-08-14 15:24 |
| Nokia 3650... | taral123 | PC Suite API and PC Connectivity SDK | 0 | 2003-07-12 00:53 |
| help about MMS attachment types | InfoSec_cn | General Symbian C++ | 0 | 2006-02-16 10:48 |
