Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-0F1CB874-391F-5D44-B960-517E447DC712"><title>Accessing the Running Applications</title><shortdesc>Applications running on a device are known as tasks. The <apiname>TApaTaskList</apiname> class is used to access applications running on a device, where each task can be an instance of the <apiname>TApaTask</apiname> class, which is used to manipulate or query tasks. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody><section id="GUID-991C9C7B-42B7-5357-B09B-C8A0F59716B0"><title>Finding an application by its UID</title> <p>The following example code shows how to find or end a running application that is, a task by its UID using the <xref href="GUID-E1A1806C-8757-35DF-A4FB-AE3C63DED364.dita"><apiname>TApaTaskList</apiname></xref> and <xref href="GUID-851055CF-D5E6-34EA-8D4B-53FC50D90C24.dita"><apiname>TApaTask</apiname></xref> classes. </p> <codeblock id="GUID-C85440FD-57E3-5CB6-88A2-6F2551B37EF7" xml:space="preserve">// Assign UID of the application to a constant, to find the application by its UID
const TUid KMyAppUid = {0x10009e9f};
// Creates an instance of a TApaTaskList taking reference to a window server session.
// TApaTaskList allows access to all tasks running on the device.
TApaTaskList taskList(CCoeEnv::Static()->WsSession());
// Creates a TApaTask instance that allows us to find out things about the task in question, for example: send a
// key-stroke to it, abort or end the task.
TApaTask task = taskList.FindApp(KMyAppUid);
// Checks whether the specified task exists on the device.
if (task.Exists())
{
task.EndTask(); // Ends the task
}</codeblock> </section> <section id="GUID-D785BAD1-5071-5766-89A7-26E925826B9F"><title>Bringing an application to the foreground</title> <p>The following code example shows how to find an application by its name and then bring it to the foreground. </p> <codeblock id="GUID-84318E73-F144-5031-853B-971E2257D0D5" xml:space="preserve">_LIT(KAppName, "myApp");
TApaTaskList taskList(CCoeEnv::Static()->WsSession());
TApaTask task = taskList.FindApp(KAppName);
if (task.Exists())
{
task.BringToForeground();
}</codeblock> </section> </conbody></concept>