WEB开发网
开发学院手机开发Symbian 开发 得到应用程序列表 Symbian S60 3rd 的方法 阅读

得到应用程序列表 Symbian S60 3rd 的方法

 2010-04-20 16:06:00 来源:WEB开发网   
核心提示:/typedef struct tagTaskUidAndCaption{TUid iUid;TBuf<0×100> iCaption;}UID_AND_CAPTION,*PUID_AND_CAPTION;/TInt CObserver::GetTasksL(RArray& aTaskUidCaptionL

/////////////////////////////////////////////////////

typedef struct tagTaskUidAndCaption

{

TUid iUid;

TBuf<0×100> iCaption;

}UID_AND_CAPTION,*PUID_AND_CAPTION;

/////////////////////////////////////////////////////

TInt CObserver::GetTasksL(RArray& aTaskUidCaptionList)

{

aTaskUidCaptionList.Reset();

//GUI

// RWsSession& wsSession = CEikonEnv::Static()->WsSession();

//EXE

RWsSession wsSession;

User::LeaveIfError(wsSession.Connect());

CApaWindowGroupName* wgName=CApaWindowGroupName::NewL(wsSession);

CleanupStack::PushL(wgName);

CArrayFixFlat* WindowGroupIds = new(ELeave)CArrayFixFlat(1);

CleanupStack::PushL(WindowGroupIds);

User::LeaveIfError(wsSession.WindowGroupList(0,WindowGroupIds));

const TInt count = WindowGroupIds->Count();

for (TInt ii=0; ii<>

{

TInt wgId = WindowGroupIds->At(ii);

wgName->ConstructFromWgIdL(wgId);

if(!wgName->Hidden())

{

//wgName->Caption()

//wgName->AppUid().Name()

//wgName->Hidden()

//wgName->IsSystem()

//wgName->IsBusy()

//wgName->AppUid()

UID_AND_CAPTION UidCaption;

UidCaption.iCaption.Copy(wgName->Caption());

UidCaption.iUid.iUid = wgName->AppUid().iUid;

aTaskUidCaptionList.Append(UidCaption);

}

}

//EXE

wsSession.Close();

CleanupStack::PopAndDestroy(2);//WindowGroupIds, wgName

return count;

}

/////////////////////////////////////////////////////

RArray iTaskUidCaptionList;

GetTasksL(iTaskUidCaptionList);

/////////////////////////////////////////////////////

注意:1、在GUI的应用程序下 User::LeaveIfError(wsSession.WindowGroupList(0,WindowGroupIds)); 才能成功。

Tags:得到 应用程序 列表

编辑录入:coldstar [复制链接] [打 印]
赞助商链接