#include <appinfo.rh>
#include <uikon.rh>
RESOURCE APP_REGISTRATION_INFO
{
...
opaque_data = r_startup_detect;
}
RESOURCE NUMBER_INT8 r_startup_detect
{
value = 1;
}
当应用程序运行时,opaque_data和其他运行参数将被忽略。因此,判断是否在运行或者不允许(区分是否应用程序被允许在启动的时候或者被用户启动)。
这样,你可以重载AppUI中的ProcessCommandParametersL()函数
T
CODE:
Bool CMyAppUi::ProcessCommandParametersL( CApaCommandLine &aCommandLine )
{
if(aCommandLine.OpaqueData().Length() > 0)
{
// Opaque data exists, app. has been manually started from the menu
}
else
{
// App. has been auto-started -> exit if auto-start in settings is OFF
}
return CEikAppUi::ProcessCommandParametersL( aCommandLine );
}
你也要注意,通过Symbian Signed需要你的应用程序有一个允许禁止自动启动的属性的选项设置。你需要加入操作代码来实现它,在 Forum Nokia Technical Library中描叙得比较好。
这篇文章仅适用于 S60 3RD,接下来的版本也将支持这个属性
译文地址:
http://www.symbianx.cn/viewthread.php?tid=5&extra=page%3D1原文地址:
http://www.newlc.com/How-to-detect-if-an-application-is.html