包括可用的物理和虚拟内存,大侠们帮个忙,非常感谢!!马上给分:)

解决方案 »

  1.   

    #12. MEMORYSTATUS mem_stat;//此结构包含了物理内存和虚拟内存的细节
    #13.
    #14. //取得内存状态
    #15. GlobalMemoryStatus(&mem_stat);
    #16.
    #17. m_strTotalMemory.Format("%ld KB",mem_stat.dwTotalPhys/1024);
    #18. m_strFreeMemory.Format("%ld KB",mem_stat.dwAvailPhys/1024);
    #19. m_strMemoryLoad.Format("%d %%",mem_stat.dwMemoryLoad);
      

  2.   

    The MEMORYSTATUS structure contains information about the current state of both physical and virtual memory. The GlobalMemoryStatus function stores information into a MEMORYSTATUS structure. typedef struct _MEMORYSTATUS { // mst 
        DWORD dwLength;        // sizeof(MEMORYSTATUS) 
        DWORD dwMemoryLoad;    // percent of memory in use 
        DWORD dwTotalPhys;     // bytes of physical memory 
        DWORD dwAvailPhys;     // free physical memory bytes 
        DWORD dwTotalPageFile; // bytes of paging file 
        DWORD dwAvailPageFile; // free bytes of paging file 
        DWORD dwTotalVirtual;  // user bytes of address space 
        DWORD dwAvailVirtual;  // free user bytes 
    } MEMORYSTATUS, *LPMEMORYSTATUS;