本文整理汇总了C++中TApaTask::EndTask方法的典型用法代码示例。如果您正苦于以下问题:C++ TApaTask::EndTask方法的具体用法?C++ TApaTask::EndTask怎么用?C++ TApaTask::EndTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TApaTask
的用法示例。
在下文中一共展示了TApaTask::EndTask方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KillApplicationL
EXPORT_C void KillApplicationL(RWsSession& aWs, TUid aUid, TInt aRetryInterval )
{
TTime wait_until; wait_until.HomeTime();
wait_until+=TTimeIntervalSeconds(15);
TApaTaskList taskList( aWs );
for(;;) {
TApaTask task = taskList.FindApp(aUid);
if(! task.Exists()) {
break;
}
TTime now; now.HomeTime();
if (now < wait_until) {
task.EndTask();
//DebugMsg(_L("waiting..."), aDebugLog);
User::After(TTimeIntervalMicroSeconds32(aRetryInterval*1000) );
} else {
break;
}
}
TApaTask task = taskList.FindApp(aUid);
if( task.Exists()) {
#ifdef __S60V3__
task.KillTask();
#else
RThread t;
if (t.Open(task.ThreadId())==KErrNone) {
//DebugMsg(_L("killing"), aDebugLog);
t.Kill(2003);
t.Close();
}
#endif
}
}
示例2: StartBrowser
static bool StartBrowser(dword uid, const char *url){
bool is_https = false;
if(text_utils::CheckStringBegin(url, text_utils::HTTPS_PREFIX))
is_https = true;
else
text_utils::CheckStringBegin(url, text_utils::HTTP_PREFIX);
const TUid uid_value = { uid };
Cstr_w par;
par.Format(L"4 %#%") <<(!is_https ? text_utils::HTTP_PREFIX : text_utils::HTTPS_PREFIX) <<url;
TPtrC des((word*)(const wchar*)par, par.Length());
TApaTaskList tl(CEikonEnv::Static()->WsSession());
TApaTask task = tl.FindApp(uid_value);
bool ok = false;
bool exists = task.Exists();
//Info("uid", uid);
if(exists && uid==0x10008d39){
//kill web browser
task.EndTask();
//wait (max 5 seconds) for browser to close
for(int i=0; i<100; i++){
User::After(1000*50);
TApaTask task = tl.FindApp(uid_value);
if(!task.Exists()){
exists = false;
break;
}
}
}
if(exists){
task.BringToForeground();
/*
Cstr_c s8;
s8.Copy(par);
TPtrC8 des8((byte*)(const char*)s8, s8.Length());
task.SendMessage(TUid::Uid(0), des8); // UID not used
*/
HBufC8 *param = HBufC8::NewL(par.Length() + 2);
param->Des().Append(des);
task.SendMessage(TUid::Uid(0), *param); // Uid is not used
delete param;
ok = true;
}else
{
RApaLsSession ls;
if(!ls.Connect()){
TThreadId tid;
int err = ls.StartDocument(des, uid_value, tid);
ls.Close();
ok = (!err);
}
}
return ok;
}
示例3: endMP
void MpFetcherTestAppView::endMP()
{
TApaTaskList taskList(CEikonEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(TUid::Uid(270564450));
if (task.Exists()) {
task.EndTask();
} else {
qCritical("Cannot bring to forward task %08x", 270564450);
}
}
示例4: HandleScreensaverEventL
TInt CLaunchSaver::HandleScreensaverEventL( TScreensaverEvent aEvent,
TAny* /*aData*/ )
{
TInt err( KErrNone );
switch ( aEvent )
{
case EScreensaverEventTimeout:
{
// Keep lights on
iHost->RequestTimeout( KLightsOnTimeoutInterval );
break;
}
case EScreensaverEventStarting:
{
// Launch new process
RApaLsSession apaLsSession;
TInt err = apaLsSession.Connect();
if ( err == KErrNone )
{
TThreadId thread;
err = apaLsSession.StartDocument( KNullDesC, KUidSaverExe, thread );
apaLsSession.Close();
}
// Switch to partial mode to save power
TScreensaverPartialMode partial;
partial.iType = EPartialModeTypeMostPowerSaving;
// Set partial mode for almost the whole screen
// (doesn't go to partial mode if whole screen is specified)
TInt height = CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iHeight;
iHost->SetActiveDisplayArea( 0, height - 1, partial );
if( err == KErrNone )
{
iHost->RequestTimeout( KLightsOnTimeoutInterval );
}
break;
}
case EScreensaverEventStopping:
{
// Kill saver process
TApaTaskList list( CEikonEnv::Static()->WsSession() );
TApaTask task = list.FindApp( KUidSaverExe );
if ( task.Exists() )
{
task.EndTask();
}
break;
}
default:
{
break;
}
} // switch ( aEvent )
return err;
}