高手帮帮忙!用wmi怎样知道一个进程的内存使用数(kb)??? 高手帮帮忙!用wmi怎样知道一个进程的内存使用数值???用那个查询发现有一个perrowdata什么的,但是里边的数值好像跟任务管理器不太一样!? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 参看http://www.codeproject.com/cs/system/wmi.asp返回的queryobject有这方面的属性 using System;using System.Management;using System.Windows.Forms;namespace WMISample{ public class MyWMIQuery { public static void Main() { try { ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Process"); foreach (ManagementObject queryObj in searcher.Get()) { Console.WriteLine("-----------------------------------"); Console.WriteLine("Win32_Process instance"); Console.WriteLine("-----------------------------------"); Console.WriteLine("Description: {0}", queryObj["Description"]); Console.WriteLine("PeakWorkingSetSize: {0}", queryObj["PeakWorkingSetSize"]); Console.WriteLine("WorkingSetSize: {0}", queryObj["WorkingSetSize"]); } } catch (ManagementException e) { MessageBox.Show("An error occurred while querying for WMI data: " + e.Message); } } }}WorkingSetSize/1024即可 多谢多谢!boylez(boylez) 和Knight94(愚翁) .解决了我一个大问题. 求教一个SQL 语句 有点难度。。。 请教各位SQL高手 vs调试时无法连接localhost web服务器 用List<T>的Find方法有点不明白 正则表达式 对数组的ref传递问题 使用powertcp telnet for .net1.0.6返不回输入命令后的结果?请教! Webclient的问题,很急,谢谢 两个命名空间共用一个类 test 送分 请问Visual Stuio.Net 2003连接SQL Server 2000的ConnectionString中的uid默认是什么呀? 如何将字符串写入XML文件 一定格式显示数据
http://www.codeproject.com/cs/system/wmi.asp返回的queryobject有这方面的属性
using System.Management;
using System.Windows.Forms;namespace WMISample
{
public class MyWMIQuery
{
public static void Main()
{
try
{
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2",
"SELECT * FROM Win32_Process"); foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("-----------------------------------");
Console.WriteLine("Win32_Process instance");
Console.WriteLine("-----------------------------------");
Console.WriteLine("Description: {0}", queryObj["Description"]);
Console.WriteLine("PeakWorkingSetSize: {0}", queryObj["PeakWorkingSetSize"]);
Console.WriteLine("WorkingSetSize: {0}", queryObj["WorkingSetSize"]);
}
}
catch (ManagementException e)
{
MessageBox.Show("An error occurred while querying for WMI data: " + e.Message);
}
}
}
}WorkingSetSize/1024即可