/// <summary> /// Finds the first window. /// </summary> /// <param name="match">The match.</param> /// <returns></returns> public Window FindFirstWindow(WindowMatcher match) { Window result = null; User32.EnumChildWindows(User32.GetDesktopWindow(), delegate(IntPtr hwnd, IntPtr lParam) { var info = new Window(hwnd); if (result != null && match(info)) { result = info; } return(1); }, IntPtr.Zero); return(result); }
/// <summary> /// Finds the window. /// </summary> /// <param name="match">The match.</param> /// <returns></returns> public List <Window> FindWindow(WindowMatcher match) { var result = new List <Window>(); User32.EnumChildWindows(User32.GetDesktopWindow(), delegate(IntPtr hwnd, IntPtr lParam) { var info = new Window(hwnd); if (match(info)) { result.Add(info); } return(1); }, IntPtr.Zero); return(result); }