小编典典

获取所有打开的窗口的标题

c#

如何检索所有打开的窗口的标题(包括Internet Explorer中的选项卡之类的窗口)?


阅读 486

收藏
2020-05-19

共1个答案

小编典典

像这样:

using System.Diagnostics;

Process[] processlist = Process.GetProcesses();

foreach (Process process in processlist)
{
    if (!String.IsNullOrEmpty(process.MainWindowTitle))
    {
        Console.WriteLine("Process: {0} ID: {1} Window title: {2}", process.ProcessName, process.Id, process.MainWindowTitle);
    }
}
2020-05-19