当N93从肖像模式调整到风景模式时如何保持当前程序在前台工作
文章信息
- 设备, 软件 版本:
S60 3rd Edition
- 描述:
一般来说如果将N93的摄像头进行翻转操作,则当前程序会切换到后台,而摄像机程序会出现在前台。
但有时为了防止这样的情况发生,我们可以通过如下方式来操作:
MCoeForegroundObserver::HandleLosingForeground()
{
const TUid KNativeCameraAppUID = { 0x101ffa86}; //The UID of the native camera application
TUid id( KNativeCameraAppUID);
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() ) //If the native camera application is running
{
RWsSession WsSession = CCoeEnv::Static()->WsSession();
TWsEvent event;
TInt ForegroundWinGroup = WsSession.GetFocusWindowGroup();
if (task.WgId()==ForegroundWinGroup) //If the native camera application is on the foreground
{
const TUid KCurrentAppUID = { 0x20004A79 }; //The UID of current runing application
TUid thisid( KCurrentAppUID );
TApaTaskList taskList1( CEikonEnv::Static()->WsSession() );
TApaTask task1 = taskList1.FindApp( thisid );
if ( task1.Exists() )
{
task1.BringToForeground();
}
}
}
}


(no comments yet)