Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving Process Description Information

Tags:

c#

.net

I am trying to retrieve process information and I'm aware that I can use:

Process[] myProcesses = Process.GetProcesses();

but how do I retrieve the process description? Is it via some Win32 API call? I'm running Vista and when I click under the Processes tab in Task Manager, I see the description.

like image 371
coson Avatar asked Jul 28 '09 05:07

coson


1 Answers

What you see in Task Manager is actually the Description field of the executable image.

You can use the GetFileVersionInfo() and VerQueryValue() WinAPI calls to access various version informations, e.g. CompanyName or FileDescription.

For .Net way, use the FileDescription member of FileVersionInfo, instantiated with the executable name got via Process.MainModule.FileName.

Another way would be through Assembly. Load the Assembly from the executable image, then query the AssemblyDescriptionAttribute custom attribute.

like image 123
CsTamas Avatar answered Oct 13 '22 01:10

CsTamas