I am using the GlobalMemoryStatusEx function to retrieve information about memory, but this function doesn\'t work correctly. It returns 0 for all properties. I
If c# you can:
Reference the Microsoft.VisualBasic assembly.
Then import Microsoft.VisualBasic.Devices namespace.
And finally use ComputerInfo to get the total physical memory.
int bytesPerMebibyte = (1 << 20); // http://physics.nist.gov/cuu/Units/binary.html
ComputerInfo myCompInfo = new ComputerInfo();
string physicalMemory = "Physical Memory: "
+ (myCompInfo.TotalPhysicalMemory / bytesPerMebibyte) + " MB";