All current running processes : Process « Development « C# / CSharp Tutorial






using System;
using System.Diagnostics;

class MainClass
{
   public static void Main()
   {
      int totMemory = 0;
      Console.WriteLine("Info for all processes:");

      Process[] allProcs = Process.GetProcesses();
      foreach(Process thisProc in allProcs)
      {
         DateTime started = thisProc.StartTime;
         totMemory += physMemory;

         Console.WriteLine("Process: {0}, ID: {1}", thisProc.ProcessName, thisProc.Id);
         Console.WriteLine("    virtual memory: {0}", thisProc.VirtualMemorySize);
         Console.WriteLine("    private memory: {0}", thisProc.PrivateMemorySize);
         Console.WriteLine("    physical memory: {0}", thisProc.WorkingSet);
      }
      Console.WriteLine("\nTotal physical memory used: {0}", totMemory);
   }
}








14.15.Process
14.15.1.Starting Processes by using ProcessStartInfo
14.15.2.Starting a new process.
14.15.3.Detecting Process Completion
14.15.4.Redirecting Process Output
14.15.5.Get all processes on local machine
14.15.6.Enumerate over threads in a given PID
14.15.7.Enumerate over mods in a given PID
14.15.8.Launch / kill a process
14.15.9.Threads in Current Process
14.15.10.Property of current Process
14.15.11.Change priority for current process
14.15.12.List all process threads in current running processes
14.15.13.All current running processes
14.15.14.Listing processes on a remote machine
14.15.15.Get processes by name
14.15.16.Get all processes running on the local computer
14.15.17.Get all processes running on the remote computer
14.15.18.Get a process on the local computer, using the process id
14.15.19.Get a process on a remote computer, using the process id
14.15.20.Display the process statistics until the user closes the program
14.15.21.Uses the ProcessStartInfo class to start new processes, both in a minimized mode
14.15.22.Using an IP address to specify the machineName parameter
14.15.23.Start a Web page using a browser associated with .html and .asp files
14.15.24.Using the computer alias (do not precede with "\\")