How To Get The Process Description Based On Process ID?(c#.net)

前端 未结 1 2040
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-22 08:01

I have tried in two ways to get the proocess description

Solution1:-

code:- Process proc = Process.GetProcessById(pid); string process_de

相关标签:
1条回答
  • 2021-01-22 08:30

    The information is contained in the VERSIONINFO resource for the executable file. You are looking for the value named FileDescription.

    Use LoadLibraryEx passing LOAD_LIBRARY_AS_IMAGE_RESOURCE. And then use the resource API, FindResource, LoadResource, LockResource etc. to obtain the version info resource. Finally, parse out the information.

    Alternatively you could parse the PE file directly which is what I suspect that programs like task manager do for performance reasons. But that would be much more complicated.

    0 讨论(0)
提交回复
热议问题