检索过程描述信息 [英] Retrieving Process Description Information
问题描述
我正在尝试检索流程信息,并且我知道我可以使用:
I am trying to retrieve process information and I'm aware that I can use:
Process[] myProcesses = Process.GetProcesses();
但是如何检索流程说明?通过某些Win32 API调用吗?我正在运行Vista,并且在任务管理器中的进程选项卡下单击时,会看到说明。
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.
推荐答案
您看到的内容在任务管理器中,实际上是可执行映像的描述字段。
What you see in Task Manager is actually the Description field of the executable image.
您可以使用 GetFileVersionInfo()
和 VerQueryValue()
WinAPI调用以访问各种版本信息,例如CompanyName或FileDescription。
You can use the GetFileVersionInfo()
and VerQueryValue()
WinAPI calls to access various version informations, e.g. CompanyName or FileDescription.
对于.Net,请使用 FileVersionInfo <的
FileDescription
成员/ code>,用通过 Process.MainModule.FileName
获得的可执行文件名实例化。
For .Net way, use the FileDescription
member of FileVersionInfo
, instantiated with the executable name got via Process.MainModule.FileName
.
另一种方式将通过 Assembly
进行。从可执行映像加载程序集,然后查询 AssemblyDescriptionAttribute
自定义属性。
Another way would be through Assembly
. Load the Assembly from the executable image, then query the AssemblyDescriptionAttribute
custom attribute.
这篇关于检索过程描述信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!