Click here to Skip to main content
15,891,748 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get Commit charge value of task manager using MFC VC++ 6.0 application.
I am trying some code but not getting the same Commit Charge value as of Task Manager. The value I am getting is much lesser than that of task manager. I don't know which format specifier I need to use to get exact value. Please help me...
Thanks...

What I have tried:

char CommitChargeInfo[10];

PERFORMANCE_INFORMATION PerfmncInfo;

GetPerformanceInfo(&PerfmncInfo,sizeof(PerfmncInfo));

sprintf(CommitChargeInfo, "%u", PerfmncInfo.CommitTotal);

m_CommitCharge.SetWindowText((CString)CommitChargeInfo);
Posted
Updated 16-Aug-16 21:19pm

1 solution

If you have a 64-bit operation system memory sizes may be greater than 4 GB. But when using VC6 you will create a 32-bit application. Then you will only get the lower 32 bits of the 64-bit memory sizes.

So when using a 64-bit operation you must create a 64-bit application where the SIZE_T type of the CommitTotal member is 64-bit wide. This requires using a recent compiler that can create 64-bit applications.
 
Share this answer
 
Comments
virus131 17-Aug-16 5:42am    
ok.. it means we can't use CommitTotal in VC6 32-bit application? If it is so, then how can I get Commit Charge value in VC6 32-bit application?
Jochen Arndt 17-Aug-16 7:55am    
You can use it but you may get a wrong value. When using a 64-bit Windows you will only get the lower 32-bits. This will be wrong if the value reported by the system is larger than 4 GB and there is no method to detect if this happens.

The task manager of a 64-bit Windows versions is a 64-bit application. If you want to create something similar, you must create a 64-bit version too.

As already suggested in my answer to your previous question:
Use a more recent Visual Studio version. You can get it for free:
https://beta.visualstudio.com/visual-studio-community-vs/

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900