简体   繁体   中英

How to get the subtitle of the processes in Windows task manager?

在此处输入图片说明

How do I get the subtitle, which is " Dell SupportAssist ", in C#?

I'm not sure what you have as a given in order to locate the name.

This is how you can do this if you know the Id of the process, not sure if you are looking for the ProcessName property of the Process class.

ProcessName

var process = Process.GetProcessById(19060).ProcessName;

If this is not what you are looking for, please provide a bit more info.

Looks like this running as a windows service.

To get a list of Windows Services you can use.

var winServices = ServiceController.GetServices();

You will need to following using statement.

using System.ServiceProcess;

And to add a reference to the following DLL.

C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework.NETFramework\\v4.6.1\\System.ServiceProcess.dll

This will return an array of type ServiceController, this object has properties such as DisplayName and ServiceName which I believe are what you are after.

You can also use LINQ to find a specific service based on these properties.

If this is not what you're after please leave a comment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM