1
如何查看邏輯內存配置?C#邏輯內存配置視圖
private void button1_Click(object sender, EventArgs e)
{
ObjectQuery winQuery = new ObjectQuery("SELECT * FROM Win32_LogicalMemoryConfiguration");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(winQuery);
foreach (ManagementObject item in searcher.Get())
{
textBox1.Text =("Total Space = " + item["TotalPageFileSpace"]);
textBox2.Text = ("Total Physical Memory = " + item["TotalPhysicalMemory"]);
textBox3.Text = ("Total Virtual Memory = " + item["TotalVirtualMemory"]);
textBox4.Text = ("Available Virtual Memory = " + item["AvailableVirtualMemory"]);
}
}
在這段代碼似乎不起作用。並且在編譯時沒有錯誤。
運行它時會顯示什麼? – danish 2012-07-20 11:58:44
什麼都沒有!毫無例外 ! – deleted 2012-07-20 12:00:58