How to obtain the list of running tasks

Source: Internet
Author: User

From: http://wiki.forum.nokia.com/index.php/%E5%A6%82%E4%BD%95%E8%8E%B7%E5%8F%96%E6%AD%A3%E5%9C%A8%E8%BF%90%E8%A1%8C%E4%BB%BB%E5%8A%A1%E7%9A%84%E5%88%97%E8%A1%A8

  • Device, software version:

S60 1st edition s60 2nd edition and FP1, fp2, fp3 s60 3rd edition and FP1

Series 80 2nd Edition

  • Detailed description:

Description

The application framework of the Symbian operating system provides a set of APIs to obtain information about the currently running tasks (whether running on the foreground or background ).

Solution

We can use tapatasklist to obtain the list of currently running tasks. The specific task is identified by the running program window group. when constructing the tapatasklist, we need to pass the session of the window server as a parameter.

#include <apgtask.h>    // link against apgrfx.lib
 
    TApaTaskList tasklist(CCoeEnv::Static()->WsSession());
 
    TApaTask taskInForeground = tasklist.FindByPos( 0 );
 
    // Window Group ID of the foreground task
 
    TInt WindowGroupIdentifier = taskInForeground.WgId();
 
    // Thread ID of the foreground task
 
    TThreadId ThreadIdentifier = taskInForeground.ThreadId();

The first task in the tapatasklist is run on the foreground (the position sequence of the related window group starts from 0)

Tapatask includes many useful information related to tasks, such as threadid () and window group (wgid ()).

In addition, some useful functions, such as endtask (), are used to request the normal shutdown of a task, and killtask () is used to directly stop a task.

The sendtobackground () and bringtoforeground () methods can be used to control the position of a program in the task list.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.