MEMORYSTATUS memstat; GlobalMemoryStatus(&memstat); total physical memory in kb = memstat.dwTotalPhys / 1024;