Symbian开发——程序后台运行
2009-04-30 13:15
323 查看
本文转至:http://blog.csdn.net/utopia2006/archive/2006/07/02/864978.aspx
这篇文章将向你展示如何在你的程序得到或失去屏幕焦点的时候控制它们和怎样控制它们。
在焦点改变的时候开始。Series 60系列的框架将在程序得到或失去屏幕焦点的时候通过CAknAppUi::HandleForegroundEventL(TBool aForeground)发出通知。当你的程序得到焦点的时候参数aForeground为ETrue,失去焦点的时候为EFalse。
如果你需要做一些特定的操作,你需要重载这个函数。这有一个不失去焦点的例子
void CMyAppUi::HandleForegroundEventL(TBool aForeground)
{
// Call Base class method
CAknAppUi::HandleForegroundEventL(aForeground);
if(aForeground)
{
// We have gained the focus
...
}
else
{
// We have lost the focus
...
}
}
改变焦点。你总是能够请求改变你程序的焦点使用命令TApaTask::SendToBackground() and TApaTask::BringToForeground()。下面代码片段显示怎样从AppUi使用它们:
void CMyAppUi::BringToForeground()
{
// Construct en empty TApaTask object
// giving it a reference to the Window Server session
TApaTask task(iEikonEnv->WsSession( ));
// Initialise the object with the window group id of
// our application (so that it represent our app)
task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
// Request window server to bring our application
// to foreground
task.BringToForeground();
}
相关文章推荐
- Symbian开发——程序在后台运行时捕获按键
- IOS开发模块总结(二)后台运行程序(2)Task completion-UIBackgroundTaskIdentifier
- iOS开发之使程序在后台运行
- iOS开发:保持程序在后台长时间运行
- Android游戏开发19:SurfaceView运行机制剖析--处理切换到后台再重新进入程序时的异常
- 让symbian 程序在后台运行
- 让symbian 程序在后台运行
- Android开发安全问题之防止页面被其他程序覆盖监听,提示用户程序转移后台运行
- symbian 安装后隐藏程序及启动后自动后台运行
- iOS开发:保持程序在后台长时间运行
- symbian-程序在后台运行
- IOS开发模块总结(二)后台运行程序(1) 后台运行程序详解(一)
- symbiann s60 3rd下GUI程序后台运行
- iOS开发小技巧--iOS程序进入后台运行的实现
- 【symbian】如何实现程序的前后台运行切换
- Android开发教程 不需要关闭后台运行程序
- Delphi开发的后台服务程序也可以7x24小时长时间稳定运行
- Android开发之旅一监听程序的前后台运行状态