C# 获取进程或线程的相关信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApp
{
class ProcessDo
{
/// <summary>
/// 获取进程相关信息
/// </summary>
public static void GetProcessInfomation()
{
Process pro = Process.GetProcessesByName("QQ")[0];
Console.WriteLine("进程名称:" + pro.ProcessName);
Console.WriteLine("进程ID:" + pro.Id.ToString());
Console.WriteLine("启动时间:" + pro.StartTime.ToLongDateString() + pro.StartTime.ToLongTimeString());
Console.WriteLine("是否响应:" + pro.Responding.ToString());
Console.WriteLine("关联进程句柄:" + pro.Handle.ToString());
Console.WriteLine("进程打开的句柄数:" + pro.HandleCount.ToString());
Console.WriteLine("主窗口句柄:" + pro.MainWindowHandle.ToString());
Console.WriteLine("主窗口标题:" + pro.MainWindowTitle);
Console.WriteLine("模块数量:" + pro.Modules.Count.ToString());
Console.WriteLine("基本优先级:" + pro.BasePriority.ToString());
Console.WriteLine("提升优先级:" + pro.PriorityBoostEnabled.ToString());
Console.WriteLine("处理器:" + pro.ProcessorAffinity.ToInt32().ToString());
Console.WriteLine("最小工作集:" + pro.MinWorkingSet.ToInt32().ToString());
Console.WriteLine("最大工作集:" + pro.MaxWorkingSet.ToInt32().ToString());
<