I want to create a tool like mini task manager. I want to show all the running processes, cpu and memory usage. Can anybody tell me related api's which I can use for this. Any link to related web page will be appreciated. (I want dump of all the statistics of running processes, cpu and memory.) Thanks in advance.
Hold Ctrl+Shift+Esc or right-click on the Windows bar, and choose Start Task Manager. In Windows Task Manager, click on More details. The Processes tab displays all running processes and their current resources usage.
The Windows UI API creates and uses windows to display output, prompt for user input, and carry out the other tasks that support interaction with the user. Most applications create at least one window.
You can check whether the exit code is STILL_ACTIVE and if so, you can call WaitForSingleObject(processHandle, 0) and check whether the return value is WAIT_TIMEOUT . If so, the process is still active, otherwise the process has returned 259 as exit code.
In Windows, this utility is the Task Manager. To get it, right-click on the Taskbar and select Task Manager from the pop-up menu that appears. This utility list all processes in categories. The first category is Apps, which are the processes that the user sees on the screen.
To do that, you will need to use the tool help functions to get snapshots of the system.
Here is a code example.
You can use EnumProcess
and openProcess
to do this.
Here is a complete sample code for this: http://msdn.microsoft.com/en-us/library/ms682623%28v=vs.85%29.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With