foreach (Process p in Process.GetProcesses())
{
try
{
if (p.MainWindowHandle != IntPtr.Zero)
{
string str = p.MainModule.FileName;
// Display the user name of the program
Console.WriteLine(str); //string s = p.ToString ();
}
}
catch
{
{
try
{
if (p.MainWindowHandle != IntPtr.Zero)
{
string str = p.MainModule.FileName;
// Display the user name of the program
Console.WriteLine(str); //string s = p.ToString ();
}
}
catch
{
}
}