From: Avi G on 28 Mar 2010 09:11 Hi, I've no experience in csharp and i search for scripts over the net for find the current cpu usage like in task manager (for all processors ) when i run it and another script that show the current Free Physical Memory. THX
From: Michael Soza on 28 Mar 2010 18:55 you can use wmi... for example Win32_OperatingSystem offers some useful information: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Management; namespace memory { class Program { static void Main(string[] args) { var query = new ObjectQuery("SELECT * FROM Win32_OperatingSystem"); ManagementObjectSearcher searcher = new ManagementObjectSearcher(query); foreach (ManagementObject item in searcher.Get()) { Console.WriteLine("FreePhysicalMemory:" + item["FreePhysicalMemory"]); Console.WriteLine("FreeVirtualMemory:" + item["FreeVirtualMemory"]); } Console.Read(); } } } for the thing of cpu usage obviously must exist some wmi class that has that information....take a look in msdn in the section of wmi classes Michael Soza. "Avi G" <AviG(a)discussions.microsoft.com> wrote in message news:FF7C4EAE-4240-420F-B82D-CACF75472A14(a)microsoft.com... > Hi, > > I've no experience in csharp and i search for scripts over the net for > find > the current cpu usage like in task manager (for all processors ) when i > run > it and another script that show the current Free Physical Memory. > > THX >
|
Pages: 1 Prev: PINVKIE PVOID * Next: Creating a DLL that would bridge an unmanaged Delphi call tomanaged C# |