×
Namespaces

Variants
Actions

无法在自定义的屏保中使用GetIndicatorPayload()方法获得键盘状态

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

文章
hoolee 在 07 Mar 2008 创建
最后由 hamishwillee 在 15 Dec 2011 编辑
  • 开发伙伴平台:

S60 2nd Edition, S60 3rd Edition, and S60 3rd Edition, FP1


  • 详细描述

使用MScreensaverPluginHost::GetIndicatorPayload(TScreensaverIndicatorIndex aIndex, TIndicatorPayload & aResult);方法时将EScreensaverIndicatorIndexKeyGuardState作为第一个参数传入,无法获得键盘状态,只返回一个非零值。


要生成一个自定义的屏保,需要使用MScreensaverPluginHost::GetIndicatorPayload()以询问键盘状态,未接来电,短消息,或情景模式等。但当我们想使用该API来获取键盘状态时,却发现在所有的S60 2nd Edition, S60 3rd Edition或S60 3rd Edition, FP1手机上都无法工作。


  • 如何重演
TIndicatorPayload result;
TInt status = MScreensaverPluginHost::GetIndicatorPayload (
EScreensaverIndicatorIndexKeyGuardState, result );
// If result is other than '0', keylock is activated
if (status == KErrNone && result.iInteger != 0)
{
// Draw key symbol
}


  • 解决方案

可以使用RAknKeyLock方法以便获得键盘状态:

RAknKeyLock keyLock;
if (keyLock.Connect() == KErrNone)
{
TBool locked = keyLock.IsKeyLockEnabled();
if (locked)
{
// Draw key symbol
}
keyLock.Close();
}
This page was last modified on 15 December 2011, at 08:50.
43 page views in the last 30 days.
×