/// <summary> /// Get the parent /// </summary> /// <param name="interopWindow">InteropWindow</param> /// <param name="forceUpdate">set to true to make sure the value is updated</param> /// <returns>IntPtr for the parent</returns> public static IntPtr GetParent(this IInteropWindow interopWindow, bool forceUpdate = false) { if (interopWindow.Parent.HasValue && !forceUpdate) { return(interopWindow.Parent.Value); } // TODO: Invalidate ParentWindow if the value changed or is IntPtr.Zero? var parent = User32Api.GetParent(interopWindow.Handle); interopWindow.Parent = parent; return(interopWindow.Parent.Value); }