I want to display icon of running process with its name when i am displaying the list to running process in C# [closed]

StackOverflow https://stackoverflow.com/questions/17401646

  •  02-06-2022
  •  | 
  •  

Question

Hi I am working on windows form. I am displaying the number of running processes across multiple virtual desktops..It is working fine. no problem in that. Please see the image...enter image description here

Now i want to display the icon of respective process with name. So can anyone tell me it is possible or not. If YES then please give some idea. so i can achieve it. Thanks for helping me.

Was it helpful?

Solution

You can get the icon using Icon.ExtractAssociatedIcon

foreach (var process in Process.GetProcesses())
{
     var icon = Icon.ExtractAssociatedIcon(process.MainModule.FileName);
}

See: Get File Icon used by Shell for more information about icons.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top