memoryctrl.cpp

来自「wince下内存测试程序」· C++ 代码 · 共 55 行

CPP
55
字号
// MemoryCtrl.cpp: implementation of the CMemoryCtrl class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "memory.h"
#include "MemoryCtrl.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMemoryCtrl::CMemoryCtrl()
{

}

CMemoryCtrl::~CMemoryCtrl()
{

}
void CMemoryCtrl::GetMemUsgesNt()
{
	MEMORYSTATUS MemStat;
	MemStat.dwLength = sizeof(MEMORYSTATUS);
	GlobalMemoryStatus(&MemStat);
	m_ulNewUsges     = MemStat.dwMemoryLoad;   //占用内存百分比
	//The approximate percentage of total physical memory that is in use
	mem = MemStat.dwAvailPhys ;//可用(就是剩余大小)Avai-有效     可用物理内存数量
	//Size of physical memory available,
	totalmem = MemStat.dwTotalPhys;//总                            总的物理内存数量
	//Total size of physical memory,
	viual = MemStat.dwAvailVirtual;//虚拟                          用户进程可用最大虚拟内存数量
    //Size of physical memory available, in bytes. 
    TotalPageFile =MemStat.dwTotalPageFile;              
	//Size of the committed memory limit
	TotalVirtual  =MemStat.dwTotalVirtual;
	//Total size of the user mode portion of the virtual address space of the calling process
	AvailPageFile =MemStat.dwAvailPageFile;
	//Size of available memory to commit,
    AvailPhys  =MemStat.dwAvailPhys;	
	//Size of physical memory available
}

void CMemoryCtrl::SetRefreshInterval(int iMs)
{
	m_iRefreshInterval = iMs;
	SetTimer(1, m_iRefreshInterval, NULL); 
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?