?
Solved

program memory usage

Posted on 2000-03-07
7
Medium Priority
?
177 Views
Last Modified: 2010-05-02
i am writing an application that requires me to obtain the memory usage for a given program under winNT and win2000.  very similar to  what  windows task manager gives you. there must be some API call to get this info. anyone know it? thanks.
0
Comment
Question by:tylerd
[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
  • 4
  • 2
7 Comments
 
LVL 1

Expert Comment

by:prozak
ID: 2593147
Check out the GlobalMemoryStatus API call.
0
 
LVL 2

Author Comment

by:tylerd
ID: 2593239
globalmemorystatus will give the me only the memory usage for the operating system as a whole.  i need to know what apps are using what amount of memory.
0
 
LVL 2

Author Comment

by:tylerd
ID: 2593250
Adjusted points to 150
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Accepted Solution

by:
prozak earned 600 total points
ID: 2593297
What you can do with that is call EnumProcesses to get all the process id's in the system and then call GetProcessMemoryInfo for each process id. Or if you already have a process id you can just call GetProcessMemoryInfo.
0
 
LVL 1

Expert Comment

by:prozak
ID: 2593307
This is in the Process Status Helper library and is available only on WinNT, this won't work on 95/98 to my knowledge.
0
 

Expert Comment

by:neoabacus
ID: 2593315
you could use the GetProcessHeap function to get the handle from the process.. then call HeapSize to determine the size of the process...

see: http://msdn.microsoft.com/library/psdk/winbase/memman_5u7k.htm
0
 
LVL 1

Expert Comment

by:prozak
ID: 2593350
Unfortunately GetProcessHeap will only give you a handle to the heap of the calling process. You can't use this to look at the heaps of other processes.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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