0

I need to get a total amount of RAM on Windows Form load. I tried to get it like this:

#include <windows.h>

Form1(void)
{
   MEMORYSTATUSEX statex;
   statex.dwLength = sizeof(statex);
   GlobalMemoryStatusEx(&statex);
   unsigned long long RAM_GB = statex.ullTotalPhys / 1024ll / 1024ll / 1024ll;
}

Here I get RAM_GB = 23, but my computer has 32GB of RAM. How does this function work? Why does it show me less memory than my computer actually has?

Perotto
  • 194
  • 1
  • 14

0 Answers0