得到应用程序列表 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
{
aTaskUidCaptionList.Reset();
//GUI
// RWsSession& wsSession = CEikonEnv::Static()->WsSession();
//EXE
RWsSession wsSession;
User::LeaveIfError(wsSession.Connect());
CApaWindowGroupName* wgName=CApaWindowGroupName::NewL(wsSession);
CleanupStack::PushL(wgName);
CArrayFixFlat
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
GetTasksL(iTaskUidCaptionList);
/////////////////////////////////////////////////////
注意:1、在GUI的应用程序下 User::LeaveIfError(wsSession.WindowGroupList(0,WindowGroupIds)); 才能成功。
更多精彩
赞助商链接