查看内存使用情况
发表于:2007-07-01来源:作者:点击数:
标签:
主要代码: void CMemStateDlg::OnButton1() { MEMORYSTATUS memStatus; CString str; memStatus.dwLength=sizeof(MEMORYSTATUS); ::GlobalMemoryStatus( m_CtrProgress.SetRange(0, (int)memStatus.dwTotalPhys/1024/1024); m_CtrProgress.SetStep(1); m_Ct
主要代码:
void CMemStateDlg::OnButton1() {
MEMORYSTATUS memStatus; CString str; memStatus.dwLength=sizeof(MEMORYSTATUS); ::GlobalMemoryStatus(&memStatus);
m_CtrProgress.SetRange(0, (int)memStatus.dwTotalPhys/1024/1024); m_CtrProgress.SetStep(1); m_CtrProgress.SetPos((int)memStatus.dwAvailPhys/1024/1024);
str.Format("%d",memStatus.dwAvailPageFile/1024/1024); GetDlgItem(IDC_VIRTUALMEM)->SetWindowText(str+" MB");
str.Format("%d",memStatus.dwTotalPhys/1024/1024); GetDlgItem(IDC_TOTALMEM)->SetWindowText(str+" MB");
str.Format("%d",memStatus.dwAvailPhys/1024/1024); GetDlgItem(IDC_AVAILMEM)->SetWindowText(str+" MB");
str.Format("%d",memStatus.dwTotalPageFile/1024/1024); GetDlgItem(IDC_TOTAL_PAGEFILE)->SetWindowText(str+" MB");
str.Format("%d",100-memStatus.dwMemoryLoad); m_CtrProgress.SetCaption("可用的物理内存 "+str+" %"); } |
原文转自:http://www.ltesting.net