比如腾讯QQ这类程序是一个进程,多个窗口的。当你打开多个聊天窗口后,只有QQ.exe 一个进程在运行。当在任务栏上会出现多个聊天窗口。请问如何通过 C# 得到任务栏的窗口总数和窗口标题?这样我能进一步地判断,QQ大致上共打开了几个聊天窗口,甚至能知道聊天窗口的窗口标题。我知道有个API是 EnumDesktopWindows 可以实现类似的功能。不知道是否有更方便的,针对任务栏的方法,谢谢大家不吝赐教.

解决方案 »

  1.   

    既然你知道api,直接用不就可以了?
      

  2.   

            [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]
            static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
            public static extern IntPtr GetForegroundWindow();类似地调用windows api就可以了
      

  3.   

    http://topic.csdn.net/u/20100611/12/6bad5b10-e00b-4fc0-98d1-5316caf501d2.html
      

  4.   

    调用System.Diagnostics;
                Process[] process = Process.GetProcesses();
                foreach(Process  p in process)
                {
                    Console.WriteLine(p.MainWindowTitle.ToString());
                }
                Console.ReadLine();