i want write on console infor of memory include installed ram and usable ram: ex: installe memory: 4,00 GB(3,80 GB usable). currently, i did get "installe memory: 4,00 GB"
public static void GetInstalledMemoryInfor()
{
ObjectQuery query = new ObjectQuery("SELECT Capacity FROM Win32_PhysicalMemory");
ManagementObjectSearcher mos = new ManagementObjectSearcher(query);
UInt64 capacity = 0;
foreach (ManagementObject WmiObject in mos.Get())
{
capacity += (UInt64)WmiObject["Capacity"];
}
Console.WriteLine(String.Format("Installed memory (RAM): {0:N} GB", capacity / (1024 * 1024 * 1024)));
}
how to get usable ram ? thanks 4 help me?
Same question was asked and answered 3 days later.
TotalPhysicalMemory from VisualBasic.Devices slightly different from WMI Win32_PhysicalMemory
Summary: win32_ComputerSYstem.TotalPhysicalMemory is what you are after
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.