Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

find a C++ program to get information that is shown in a 'Task Manager' performance window

Posted on 2010-09-08
6
Medium Priority
?
407 Views
Last Modified: 2013-12-04
I need to write a C++ program to monitor what is currently available memory, how much cpu time is used and other information shown in Windows 'Task Manager'. Any clue?
0
Comment
Question by:Ziren
6 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 33632057
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33635093
GlobalMemoryStatus/GlobalMemoryStatusEx to detect the memory:
http://msdn.microsoft.com/en-us/library/aa366589(VS.85).asp
There is an example.

GetProcessTimes gives a time information about processes - how long the process is running:
http://msdn.microsoft.com/en-us/library/ms683223(VS.85).asp

If you need to collect the performance data, you may use PdhOpenQuery,etc. Here is an example:
MSDN. Writing Performance Data to a Log File
http://msdn.microsoft.com/en-us/library/aa373228(VS.85).asp

You can find a lot in MSDN:
Performance Monitoring
http://msdn.microsoft.com/en-us/library/ee663292(v=VS.85).asp
You can download Process Explorer from Microsoft SysInternals:
http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

Check this CodeProject article: Process viewer
http://www.codeproject.com/KB/cpp/processviewer.aspx
Maybe, here is everything you are looking for.
0
 
LVL 1

Expert Comment

by:XMarshall10
ID: 33635777
To get you started, you can start your project by Enumerating all the process running in your local system by using Win32 API's like EnumProcesses. List all the process in a window.

Then refer to the above links provided by the other experts for gathering further information's like memory, cpu time, etc.

--XM
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Accepted Solution

by:
Ziren earned 0 total points
ID: 33638816
thanks very much for you guy's inputs, now I have one question solved on how to get memory usage information. I tried the method at 'http://www.codeproject.com/KB/system/MultiCPUUsage.aspx' to get cpu usage but failed, When run the program, there is no error message, but cpu usage is always 0. Is there other way to get this information?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33639694
try this http://www.cplusplus.com/forum/windows/14580/ - tweaked version after initial post
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33758990
So what did you do to solve it?
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

927 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