On Windows XP, how do I list all windows displayed by the system (C #),

I would like to get a list (or array or whatever) of all visible (including minimized) windows.

I found 2 similar questions that don't quite give me what I'm looking for:
- Determine which windows are in the alt-tab list
- display windows in another user session

Thank.

0


source to share


3 answers


I think the blog post by Raymond Chen in the first link gives you an idea of ​​where you want to go. Basically, you would call EnumWindows and then apply this algorithm, except that you would notice every window handler that is visible.



The question is a bit vague what is the purpose here (maybe a better way gave more information).

+2


source


How about this to get a list of processes that will go into the alt-tab list. (Starting processes containing a window):



using System.Diagnostics.Process; 

List<Process> plist = new List<Process>();            

foreach (Process p in Process.GetProcesses())
{
 string title = p.MainWindowTitle;
 if (!String.IsNullOrEmpty(title))
 {
     plist.Add(p);
 }
}

      

+1


source


Just use the EW () api (win32 FAQ)

0


source







All Articles