请问利用Management类,怎么求得系统当年剩余的物理内存!我只知道用Win32_PhysicalMemory判断,能求出整个的物理内存值,可是当前剩余的物理内存值却不知道怎么求了。请高手指点!谢谢!

解决方案 »

  1.   

    用WMI类,比如:using System;
    using System.Management;
    using ROOT.CIMV2.Win32;public class App
    {
       public static void Main()
       {
          // Enumerate instances of the Win32_process.
          // Print the Name property of the instance.
          foreach(Process ps in Process.GetInstances())
          {
             Console.WriteLine(ps.Name);
          }      // Initialize the instance of LogicalDisk with
          // the WMI instance pointing to logical drive d:.
          LogicalDisk dskD = new LogicalDisk(new ManagementPath(
            "win32_LogicalDisk.DeviceId=\"d:\""));
          Console.WriteLine(dskD.Caption);
       }
    }
      

  2.   

    time_is_life(今夜太冷:http://timeislife.blog.sohu.com):谢谢你。我查MSDN了,我只找到能求总的物理内存,却没找到求当前剩余的物理内存。我不知道它能不能求,也就是说,我不知道用这个WMI类能不能解决我的问题。