I need to get the name of the process that is active on the screen, however I need to bring the same one appears in the Task Manager in description.
For example if I use processName
it will bring "Chrome" I need it to be description = Google Chrome.
I've tried this:
foreach (Process p in Process.GetProcesses())
{
if (p.MainWindowTitle.Length > 0)
{
if (app.NomeAplicativo.Contains(p.ProcessName))
{
Console.WriteLine("Process Name:" + p.ProcessName.ToString());
}
Console.WriteLine("Process Name:" + p.ProcessName);
}
}
And using this face:
public static Int32 GetWindowProcessID(IntPtr hwnd)
{
// Esta função é usada para obter o AID do processo ativo ...
Int32 pid;
GetWindowThreadProcessId(hwnd, out pid);
return pid;
}
But in both, I can not get the description of the process.