2008年7月1日星期二

调用系统发短信服务

void CSENAppUi::CreateAndSendMessageL()
{

CMessageData* message = CMessageData::NewLC();
CParaFormatLayer* iParaFormatLayer = CParaFormatLayer::NewL();
CCharFormatLayer* iCharFormatLayer = CCharFormatLayer::NewL();
CRichText* iRichText =
CRichText::NewL (iParaFormatLayer,iCharFormatLayer);

TInt pos= 0;
HBufC *iBufStr = StringLoader::LoadLC(R_QTN_SEND_COMMENT_OTHER_INFO_STR);
iRichText->InsertL(pos, iBufStr->Des());
CleanupStack::PopAndDestroy(iBufStr);

// Set the body text
message->SetBodyTextL(iRichText);

// start message editor through SendUI
iSendUi->CreateAndSendMessageL( KSenduiMtmSmsUid, message,KNullUid, EFalse );
//============================================
CleanupStack::PopAndDestroy( message );

delete iRichText;

}

没有评论: