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
  •  | 
  •  

Pergunta

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.

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top