3
I need to get the name of the process that is active on the screen, but I need to bring equal appears in Task Manager description.
For example if I use processName
it will bring "Chrome" I need it to be description = Google Chrome.
I’ve tried it like 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 guy:
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’t get the description of the process.
Lucas, download the source of Processhacker, there you find the way to do this search. But you will need to use the call of Interop.
– lsalamon
Did any of the answers solve your problem? Do you think you can accept one of them? If you haven’t already, see [tour] how to do this. You would help the community by identifying the best solution for you. You can only accept one of them, but you can vote for any question or answer you find useful on the entire site.
– Maniero