×
Namespaces

Variants
Actions

Archived:Retrieving a list of currently running tasks using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.


Article Metadata
Compatibility
Platform(s): S60 1st Edition
S60 2nd Edition and FP1, FP2, FP3
S60 3rd Edition and FP1
Series 80 2nd Edition
S60 3rd Edition FP1
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
S60 1st Edition
Article
Created: User:Technical writer 2 (10 May 2007)
Last edited: hamishwillee (14 Jun 2012)

Overview

Retrieving a list of currently running tasks

Description

Application framework in Symbian OS provides APIs for retrieving information about the tasks that are currently running either in foreground or background.

Solution

A list of currently running tasks can be retrieved with TApaTaskList class. A task is identified by its association with the running application's window group. A session to the window server needs to be passed to TApaTaskList during construction.
#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 TApaTaskList is the one in foreground (the associated window group has ordinal position 0).
TApaTask contains some information about the task. For example, the thread identifier (ThreadId()) and window group identifier (WgId()).
Furthermore, there are useful methods such as EndTask() that requests the task to close normally, and KillTask() that directly terminates the task. SendToBackground() and BringToForeground() can be used for controlling the application's position in the task list.

This page was last modified on 14 June 2012, at 10:33.
53 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×