The code is quite simple. In the following demo, we will show all the processes running on your machine, plus a check if you are running Windows Live Messenger (a.k.a. MSN Messenger).
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
namespace CheckRunningProcesses
{
class Program
{
static void Main(string[] args)
{
const string messenger = "msnmsgr";
bool runningMessenger = false;
// Get Collection of running processes from Process Static method
Process[] processes = Process.GetProcesses();
// Scan processes in the obtained collection
foreach (Process p in processes)
{
Console.WriteLine(p.ProcessName);
if (p.ProcessName == messenger)
{
runningMessenger = true;
}
}
if (runningMessenger)
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("You have Windows Live Messenger (MSN) Running");
}
Console.ReadLine();
}
}
}
Note: The above code does not check whether you are signed in to the msn service. It just checks whether the MSN executable is running.