×
Namespaces

Variants
Actions

检测相机程序是否正在运行

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

兼容于
平台: S60 3rd Edition

文章
翻译:
hoolee
最后由 hamishwillee 在 05 Jul 2012 编辑


  • 详细描述

为了查找相机程序是否正在运行,需要TApaTaskList查找当前正在运行的任务列表。

注意在有些手机上,如Nokia N93和Nokia N93i,相机程序总是运行在后台,而且在后台时在任务列表中是隐藏的。

  • 解决方案

如果摄像头正在运行,而且没有隐藏在任务列表中,那么下列函数就会返回ETrue

需要能力:无

#include <apgtask.h>      // link against apgrfx.lib
#include <apgwgnam.h>
 
// The UID of the native camera application
const TUid KNativeCameraAppUID = { 0x101ffa86 };
 
TBool CheckCameraStatusL()
{
TUid id( KNativeCameraAppUID );
TApaTaskList taskList( iWsSession ); // iWsSession is of type RWsSession
TApaTask task = taskList.FindApp( id );
 
if( task.Exists() )
{
CApaWindowGroupName* wgName =
CApaWindowGroupName::NewLC( iWsSession, task.WgId() );
 
TBool isHidden = wgName->Hidden();
CleanupStack::PopAndDestroy(); // wgName
 
if(!isHidden)
{
return ETrue;
}
}
return EFalse;
}
This page was last modified on 5 July 2012, at 07:42.
103 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.

×