Beispiel #1
0
        /// <summary>
        ///     Get the WindowPlacement
        /// </summary>
        /// <param name="interopWindow">InteropWindow</param>
        /// <param name="forceUpdate">set to true to make sure the value is updated</param>
        /// <returns>WindowPlacement</returns>
        public static WindowPlacement GetPlacement(this IInteropWindow interopWindow, bool forceUpdate = false)
        {
            if (interopWindow.Placement.HasValue && !forceUpdate)
            {
                return(interopWindow.Placement.Value);
            }
            var placement = WindowPlacement.Create();

            User32Api.GetWindowPlacement(interopWindow.Handle, ref placement);
            interopWindow.Placement = placement;
            return(interopWindow.Placement.Value);
        }