S
H
A
R
E

Monday, May 16, 2011

CSharp Get Process List

//This A ConsoleApplication
using System;
using System.Diagnostics; //manual using

class Program
{
    static void Main()
    {
        // Get List Of Running process
        Process [] proc = Process.GetProcesses();
        // Get one-by-one of process lists.
        foreach (Process p in proc)
        {
            try
            {
                Console.Write(p.MainModule.FileName.ToString());
                if (p.MainWindowTitle.Length > 0)
                Console.WriteLine(" - " + p.MainWindowTitle.ToString());
                else Console.WriteLine();
            }
            catch (Exception e){}
       }
        Console.ReadKey();
    }

0 comments:

Post a Comment