Click here to Skip to main content
13,351,457 members (46,484 online)
Click here to Skip to main content
Add your own
alternative version


25 bookmarked
Posted 11 Dec 2005

A Simple Windows Mobile 5.0 Task Enumerator

, 11 Dec 2005
Rate this:
Please Sign up or sign in to vote.
A simple task enumerator for Windows Mobile SmartPhones.


This is a part of a big initiative which includes some task management activities for Windows Mobile 5.0. I hope this would give you an idea of Windows Mobile 5.0 task management APIs and their implementations. I believe you have a good idea of Win32 architecture to fully understand this stuff.

About Windows Task Manager

Windows Task Manager is a user interface extended by the Windows OS to help users manage tasks. The user interface includes all the details of a basic task (process) context and presents it in a friendly interface. I have tried creating some interfaces like this in the PC world using VC++/MFC.

The Associated APIs

Rather than explaining the full source code in detail, I would give you an idea of the APIs specific for task management. Since the basic process libraries which include the APIs like TerminateProcess, EnumerateProcess remain unavailable in the Windows Mobile environment, I tried using some other APIs.

I have created a thread to run in background to enumerate all the tasks. See the thread DWORD WINAPI ProcessViewThread(PVOID lParam).

Let's start now:

  1. The thread first takes a snapshot of the system processes by using the CreateToolhelp32Snapshot() API, which returns a handle to the snapshot for further usage.
  2. Then, the thread calls Process32First() to get the details of the first process into a PROCESSENTRY32 predefined structure.
  3. It sends a Windows message to the list control added in the GUI to intimate about the new entry into it, by handling the LB_ADDSTRING Windows list control message.
  4. Then, it iteratively calls Process32Next() till it returns a FALSE. That means all the information of all the processes has been captured.
  5. But the program should safely close the handle to the snapshot by calling CloseToolhelp32Snapshot() to avoid resource/handle leaks.

That's all about it.

Further Modifications Required

  1. The listbox which enumerates all the processes lists them very slow. It would be great if you could collect all the process names in a buffer and update it in the list box in a regular fashion.
  2. TODO: Currently working to improve the GUI, include more process details, etc. the project.

Latest Additions

  1. Added facility to stop a process.
  2. Added soft-key enabled operations.

Comments solicited.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Sreekanth Muralidharan
Technical Lead
India India
I am a personality from Trivandrum , a green peaceful place in Kerala, South India.
I have been an enthusiast of Windows programming when I started creating simple windows when I learnt VC++ in LCC in Trivandrum. From then on its all about Windows in my flesh and blood.
My career graph moves like this:
1. I started working as a C/C++ programmer in a company in Trivandrum where I learnt the ABCs of Software Industry. I worked with them for about 1 year. I could not contine since I was in contract for 1 year.
2. Then I joined another organization in Trivandrum who gave me challenges to love. They made me mad about VC++ and Windows.
I was mad about Embedded Systems which made me, Myself = Embedded Systems + VC++.
3. Software Engineer in a telecom company in Hyderabad, Andhra Pradesh, S.India.
4. Currently working with a telecom company in Bangalore.
I totally, so, have experience of about 4.5 years.

You may also be interested in...


Comments and Discussions

QuestionProblem to create dynamic buttons using MFC Pin
susilrani29-Apr-08 0:46
membersusilrani29-Apr-08 0:46 
Questionproblem in porting wince to smdk 2410 board. Pin
amiya das30-Mar-08 22:49
memberamiya das30-Mar-08 22:49 
GeneralRe: sms all Pin
Sreekanth Muralidharan8-Nov-06 7:37
memberSreekanth Muralidharan8-Nov-06 7:37 
GeneralNice but a Suggestion... Pin
ThatsAlok12-Dec-05 18:09
memberThatsAlok12-Dec-05 18:09 
Window Mobile Process Enumertator is nice idea... But don't you think 2 mb+ Source code is little bulky!

"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

Alok Gupta
VC Forum Q&A :- I/ IV
GeneralRe: Nice but a Suggestion... Pin
Sreekanth Muralidharan12-Dec-05 18:13
memberSreekanth Muralidharan12-Dec-05 18:13 
GeneralRe: Nice but a Suggestion... Pin
ThatsAlok12-Dec-05 18:54
memberThatsAlok12-Dec-05 18:54 
GeneralRe: Nice but a Suggestion... Pin
Sreekanth Muralidharan13-Dec-05 0:58
memberSreekanth Muralidharan13-Dec-05 0:58 
GeneralRe: Nice but a Suggestion... Pin
ThatsAlok13-Dec-05 1:09
memberThatsAlok13-Dec-05 1:09 
JokeRe: Nice but a Suggestion... Pin
ThatsAlok12-Dec-05 18:57
memberThatsAlok12-Dec-05 18:57 
GeneralRe: Nice but a Suggestion... Pin
Member 239604223-Jan-09 9:45
memberMember 239604223-Jan-09 9:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180111.1 | Last Updated 11 Dec 2005
Article Copyright 2005 by Sreekanth Muralidharan
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid