Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Mimicking Windows Task Manager

Posted on 2004-04-18
4
Medium Priority
?
746 Views
Last Modified: 2013-12-03
I'm trying to write an app to mimick the Windows Task Manager Processes tab. I can get a list of all the running processes using this code:

procedure TForm1.Button1Click(Sender: TObject);
var
 I: Integer;
 Snapshot: THandle;
 PE: TProcessEntry32;
begin
 ListBox1.Clear;
 Snapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
 if (Snapshot = DWORD(-1)) then
     Exit;
 PE.dwSize := SizeOf(TProcessEntry32);
 if Process32First(Snapshot, PE) then
 repeat
   I := ListBox1.Items.Add(PE.szExeFile);
 until not Process32Next(Snapshot, PE);
 CloseHandle (Snapshot);
end;

Which works great, but I'd like to show other stuff like the CPU usage used, RAM used etc by each process. The app needs to run under Win2000/XP/2003 (ie. not 9X).

I think this information might be obtainable via WMI but it needs to be fast (WMI seems to be a little slow/CPU-intensive) so another method would be preferable :)
0
Comment
Question by:nem2k4
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:MikProg
ID: 10856751
Key words "Performance Objects and Counters" in Win32 Developer's reference (Windows SDK in Delphi menu). But it is not so easy as process listing.
0
 

Author Comment

by:nem2k4
ID: 10856811
Damn I was hoping you wouldn't say that :( :D
0
 
LVL 3

Expert Comment

by:MikProg
ID: 10857033
Don't worry! Seek Internet. Some days ago I read piece of source that realise counter readng. If I would know you need it. It was one of the poplular Delphi sites but I can't remeber name (today I can't remember my name. Ooh! These weekend's)
0
 
LVL 7

Accepted Solution

by:
sftweng earned 150 total points
ID: 10857274
Perhaps you could use the Performance Data Helper (pdh.h) - see http://swiss.torry.net/classes.htm
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question