如何在自己的文件夹中创建短信
我用以下代码想在我自己的文件夹创建一条短信,我是在短信的我的文件夹中创建了一个自己的目录,然后要在这个目录中创建短信。
void CSmsSocketEngine::CreateNewMessageToMyFolderL(const TDesC& aAddr,
const TDesC& aContent)
{
const TInt LEN = 12;
iSmsMtm->SwitchCurrentEntryL(KMsvMyFoldersEntryIdValue); //test!
TTime bTime;
bTime.UniversalTime();
TMsvEntry newIndexEntry;
newIndexEntry.iDate = bTime;
//newIndexEntry.iDate.HomeTime();
newIndexEntry.SetInPreparation(ETrue);
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);
//以下两行创建到收件箱,短信的状态已改为已读,不会有声音提示
/* newIndexEntry.SetUnread(EFalse);
newIndexEntry.SetNew(EFalse);*/
//in 3rd edition crashes here if capabilities are wrong
newIndexEntry.iServiceId = iSmsMtm->ServiceId();
iSmsMtm->Entry().CreateL(newIndexEntry);
TMsvId smsId = newIndexEntry.Id();
iSmsMtm->SwitchCurrentEntryL(smsId);
iSmsMtm->Entry().ChangeL(newIndexEntry);
iSmsMtm->SaveMessageL();
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);
TLocale locale;
TTimeIntervalSeconds universalTimeOffSet(locale.UniversalTimeOffset());
TInt tempTime = universalTimeOffSet.Int();
TInt numQuarterHours = universalTimeOffSet.Int() / 3600;
CSmsPDU *pdu = &mySmsHeader->Message().SmsPDU();
CSmsDeliver *dpdu = STATIC_CAST(CSmsDeliver*,pdu);
TTime aTime;
aTime.UniversalTime();
dpdu->SetServiceCenterTimeStamp(aTime,numQuarterHours);
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
return;
}
目录已经创建了,在创建 短信时我指定了 KMsvMyFoldersEntryIdValue ,但是它把短信创建到我的文件夹里了,没有在我自己的目录里,达人帮我看看啊。谢谢了!
void CSmsSocketEngine::CreateNewMessageToMyFolderL(const TDesC& aAddr,
const TDesC& aContent)
{
const TInt LEN = 12;
iSmsMtm->SwitchCurrentEntryL(KMsvMyFoldersEntryIdValue); //test!
TTime bTime;
bTime.UniversalTime();
TMsvEntry newIndexEntry;
newIndexEntry.iDate = bTime;
//newIndexEntry.iDate.HomeTime();
newIndexEntry.SetInPreparation(ETrue);
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);
//以下两行创建到收件箱,短信的状态已改为已读,不会有声音提示
/* newIndexEntry.SetUnread(EFalse);
newIndexEntry.SetNew(EFalse);*/
//in 3rd edition crashes here if capabilities are wrong
newIndexEntry.iServiceId = iSmsMtm->ServiceId();
iSmsMtm->Entry().CreateL(newIndexEntry);
TMsvId smsId = newIndexEntry.Id();
iSmsMtm->SwitchCurrentEntryL(smsId);
iSmsMtm->Entry().ChangeL(newIndexEntry);
iSmsMtm->SaveMessageL();
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);
TLocale locale;
TTimeIntervalSeconds universalTimeOffSet(locale.UniversalTimeOffset());
TInt tempTime = universalTimeOffSet.Int();
TInt numQuarterHours = universalTimeOffSet.Int() / 3600;
CSmsPDU *pdu = &mySmsHeader->Message().SmsPDU();
CSmsDeliver *dpdu = STATIC_CAST(CSmsDeliver*,pdu);
TTime aTime;
aTime.UniversalTime();
dpdu->SetServiceCenterTimeStamp(aTime,numQuarterHours);
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
return;
}
目录已经创建了,在创建 短信时我指定了 KMsvMyFoldersEntryIdValue ,但是它把短信创建到我的文件夹里了,没有在我自己的目录里,达人帮我看看啊。谢谢了!
...全文
相关推荐
短信接口C++程序源码
短信接口C程序源码,完整程序模块,可直接应用。
二个android模拟器互发短信程序演示
二个android模拟器互发送短信程序示例,大家参考使用吧
短信发送详解
前言:关于短信的发送其实是很简单的,只需要调用一下API即可,本章博客用互亿无线给大家开发这个功能。 第一步:官网打开链接接口地址 网站中有个接口下载,下载后出现下面的文件夹 文件夹介绍:点开文件夹DEMO,里面有各类程序的案例,我们找到java的打开,套用 第二步:编写程序 写看一下程序整体 – 首先创建MyJob类,并实现org.quartz.Job接口 public class MyJob implements Job { @Override public void execute(JobExecutionContext jobExecutionContext
星外短信接口星外短信插件
星外短信接口星外短信插件,傻瓜式操作。上传就可以使用。短信精灵,开发整理。
[VB.NET源码]西门子短信文件夹文件读取器
到我的博客去哦,有更多的源码下载的………… http://blog.csdn.net/mohongmao/


