public bool LoopThroughWindows(IntPtr hWnd, IntPtr lParam) { string hwndString = IntPtrToString(hWnd); StringBuilder sb = new StringBuilder(10000); Win32Funcs.GetClassName(hWnd, sb, sb.Capacity); string windowTitle = sb.ToString(); bool isAltTab = IsAltTabWindow(hWnd, windowTitle); if (isAltTab) { if (!tempWindowsFoundSoFar.ContainsKey(hwndString)) { thingsToAdd.Add(hWnd); } shouldKeep[hwndString] = true; return(true); } bool isDialog = isDialogBox(hWnd, windowTitle); if (isDialog) { shouldKeep[hwndString] = true; if (Win32Funcs.IsWindowVisible(hWnd)) { if (!tempWindowsFoundSoFar.ContainsKey(hwndString)) { thingsToAdd.Add(hWnd); } } return(true); } if (tempWindowsFoundSoFar.ContainsKey(hwndString)) { thingsToRemove.Add(hWnd); shouldKeep[hwndString] = true; return(true); } return(true); }
private IntPtr GetLastVisibleActivePopUpOfWindow(IntPtr window) { IntPtr lastPopUp = Win32Funcs.GetLastActivePopup(window); if (Win32Funcs.IsWindowVisible(lastPopUp)) { return(lastPopUp); } else if (lastPopUp == window) { return(IntPtr.Zero); } else { return(GetLastVisibleActivePopUpOfWindow(lastPopUp)); } }