View Full Version : نمایش cpu Using , Memory
MehdiLiver
دوشنبه 03 اسفند 1388, 01:03 صبح
سلام
چطور میشه در فرم Cpu Using رو در یک Label
و Memory رو در یک Label دیگه نمایش داد ؟؟؟
r00tkit
دوشنبه 03 اسفند 1388, 01:37 صبح
using System.Diagnostics;
PerformanceCounter cpuCounter;
PerformanceCounter ramCounter;
cpuCounter = new PerformanceCounter();
cpuCounter.CategoryName = "Processor";
cpuCounter.CounterName = "% Processor Time";
cpuCounter.InstanceName = "_Total";
ramCounter = new PerformanceCounter("Memory", "Available MBytes");
public string getCurrentCpuUsage(){
cpuCounter.NextValue()+"%";
}
public string getAvailableRAM(){
ramCounter.NextValue()+"MB";
}
حالا مقدار هار رو تو لیبل قرار بده با
label1.Text=getCurrentCpuUsage();
:چشمک:
از timer استفاده کن تا برنامت dynamic بشه
vBulletin® v4.2.5, Copyright ©2000-1403, Jelsoft Enterprises Ltd.