Obtaining the Current Memory Status

The function GlobalMemoryStatus can be used to return information about thecurrent memory usage for Windows CE—the information is returned in a MEMORYSTATUS structure, as shown in Listing 12.2.

Listing 12.2. Displaying memory usage with GlobalMemoryStatus
void Listing12_2()
{
  MEMORYSTATUS ms;
  ms.dwLength = sizeof(ms);
  GlobalMemoryStatus(&ms);
  cout ≪ _T("Total Phys: ") ≪ ms.dwTotalPhys ≪ endl;
  cout ≪ _T("Avail Phys:") ≪ ms.dwAvailPhys ≪ endl;
  cout ≪ _T("Total Page: ")
       ≪ ms.dwTotalPageFile ≪ endl;
  cout ≪ _T("Avail Page: ")
       ≪ ms.dwAvailPageFile ≪ endl;
  cout ≪ _T("Total Virtual: ")
       ≪ ms.dwTotalVirtual ≪ endl;
  cout ≪ _T("Avail Virtual: ")
       ≪ ms.dwAvailVirtual ≪ endl;
}

Typical output for a Windows CE device looks ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.