Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

用自带短信阅读程序播放一条文本消息

From Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台: S60 3rd Edition, FP1

文章
翻译:
huwell
最后由 hamishwillee 在 19 Oct 2011 编辑
CS001119


  • 开发伙伴平台:

S60 3rd Edition, FP1


  • 详细描述

使用AIW你可以让预先安装的短信阅读程序阅读任何存储在短信文件夹中的信息。


这个程序自签名即可执行。


这个API只能在装有短信阅读程序的手机上才能工作


MMP文件

需要下列库

LIBRARY servicehandler.lib 
0


资源文件

增加下列头文件:

#include <AiwCommon.hrh>
#include <AiwCommon.rh>


接着在MENU_PANE中增加如下定义

MENU_ITEM
{
command = EAIWPlaceHolder1;
txt = "";
}


并且定义AIW菜单项如下:

RESOURCE AIW_INTEREST R_AIWTEST_MSG
{
items =
{
AIW_CRITERIA_ITEM
{
id = EAIWPlaceHolder1;
serviceCmd = KAiwCmdView; //from aiwcommon.hrh
serviceClass = KAiwClassMenu; //from aiwcommon.hrh
contentType = "message/*";
}
};
}


源文件

增加下列头文件:

#include <AiwServiceHandler.h>

构建一个CAiwServiceHandler并赋予该菜单项。这里代码假设iEntry是该类的一个成员变量。他的类型是TMsvEntry,用来存储有效

信息。

iServiceHandler = CAiwServiceHandler::NewL();
iServiceHandler->AttachMenuL(R_AIWTEST_MENU, R_AIWTEST_MSG);


当菜单显示时增加实际的菜单项

void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane *aMenuPane )
{
 
if(aResourceId == R_AIWTEST_MENU)
{
CAiwGenericParamList* params = CAiwGenericParamList::NewLC();
 
TPckgC<TMsvEntry> packedEntry(iEntry);
TAiwGenericParam mailParam( EGenericParamMessageItem);
mailParam.Value().Set(packedEntry);
params->AppendL( mailParam );
 
// Let AIW provider add its menu items to the menu.
iServiceHandler->InitializeMenuPaneL(
*aMenuPane,
aResourceId,
EAIWExampleCmdLast,
*params);
 
}
}

要播放这个信息,用户可以选择这个新增的菜单,然后你就如下处理即可:

CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
 
TPckgC<TMsvEntry> packedEntry(iEntry);
TAiwGenericParam mailParam( EGenericParamMessageItem);
mailParam.Value().Set(packedEntry);
paramList->AppendL( mailParam );
 
iServiceHandler->ExecuteMenuCmdL(
aCommand,
*paramList,
iServiceHandler->OutParamListL(),
0,
this);
 
CleanupStack::PopAndDestroy(paramList);
This page was last modified on 19 October 2011, at 04:29.
95 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×