/// <summary> /// Synchronously enumerates windows and returns a window list /// </summary> /// <returns>list of windows</returns> public static List <WindowInfo> Enumerate(bool excludeThisProcess = true) { _currentProcess = Process.GetCurrentProcess(); _excludeThisProcess = excludeThisProcess; _shellWindowHandle = User32Interop.GetShellWindow(); windowList = new List <WindowInfo>(); User32Interop.EnumDesktopWindows(IntPtr.Zero, enumWindowsCallback, IntPtr.Zero); return(windowList); }