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
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:
- 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.
- Then, the thread calls
Process32First() to get the details of the first process into a
PROCESSENTRY32 predefined structure.
- 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.
- Then, it iteratively calls
Process32Next() till it returns a
FALSE. That means all the information of all the processes has been captured.
- 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
- 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.
- TODO: Currently working to improve the GUI, include more process details, etc. the project.
- Added facility to stop a process.
- Added soft-key enabled operations.
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.