获取内存使用情况 [英] Getting memory usage

查看:109
本文介绍了获取内存使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想使用VC ++ 6.0 MFC应用程序获取当前正在运行的进程和任务管理器的每个进程的内存使用情况。我不知道怎么做。



请帮帮我..



谢谢..



我尝试了什么:



我试过一些代码,这没有用。我对此一无所知。请提供一些代码。



I want to get memory usage of my currently running process and each process of task manager using VC++ 6.0 MFC application. I don't know how to do this.

Please help me..

Thanks..

What I have tried:

I have tried some code, which was not helpful. I don't know anything about this. Please provide some code.

推荐答案

使用 GetProcessMemoryInfo函数(Windows) [ ^ ]检索有关进程内存使用情况的信息。



要获取进程的信息,请传递 GetCurrentProcess函数(Windows) [ ^ ]。



适用于所有流程你必须枚举它们:枚举所有进程(Windows) [ ^ ]。



所有流程的内存信息示例代码可以在这里找到:收集进程的内存使用信息(Windows) [ ^ ]。



注意可能无法使用VC6构建这些示例,因为VC6安装的Windows SDK可能不存在所需的头文件。然后,您必须使用最新的Visual C ++版本。 VC6于1998年发布,最后一个服务包来自2004年。
Use the GetProcessMemoryInfo function (Windows)[^] to retrieve information about the memory usage of a process.

To get the information for your process pass the handle returned from the GetCurrentProcess function (Windows)[^].

For all processes you have to enumerate them: Enumerating All Processes (Windows)[^].

Example code for memory information of all processes can be found here: Collecting Memory Usage Information For a Process (Windows)[^].

Note that it might not be possible to build these examples with VC6 because required header files might be not present with the Windows SDK installed by VC6. Then you must use a recent Visual C++ version. VC6 was released in 1998 and the last service pack is from 2004.


这篇关于获取内存使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆