public static List <CInfoWindow> GetAllVisibleChildWindowInfo(this IntPtr hWndParent, bool Deep) { List <CInfoWindow> aInfo = new List <CInfoWindow>(); Dictionary <IntPtr, IntPtr> aChildParentHandle = new Dictionary <IntPtr, IntPtr>(); GetHandleList(ref aChildParentHandle, hWndParent, Deep); foreach (KeyValuePair <IntPtr, IntPtr> kv in aChildParentHandle) { CInfoWindow Info = GetWindowInfo(kv.Key); Info.HandleParent = kv.Value; aInfo.Add(Info); } return(aInfo); }
public static IntPtr GetHandleByWindowCaptionAndSizeLike(string Caption, Size Size, int SizeTolerance) { Dictionary <IntPtr, IntPtr> aChildParent = new Dictionary <IntPtr, IntPtr>(); GetHandleList(ref aChildParent, GetDesktopWindow(), true); foreach (KeyValuePair <IntPtr, IntPtr> kv in aChildParent) { CInfoWindow Info = kv.Key.GetWindowInfo(); if (!string.IsNullOrEmpty(Caption) && CLang.Like(Info.Caption, Caption, true) && (Math.Abs(Info.PositionSize.Width - Size.Width) <= SizeTolerance) && (Math.Abs(Info.PositionSize.Height - Size.Height) <= SizeTolerance) ) { return(kv.Key); } } return(IntPtr.Zero); }