Binarysharp.MemoryManagement.Windows.WindowCore.SetWindowPlacement C# (CSharp) Method

SetWindowPlacement() public static method

Sets the show state and the restored, minimized, and maximized positions of the specified window.
public static SetWindowPlacement ( IntPtr windowHandle, WindowPlacement placement ) : void
windowHandle System.IntPtr A handle to the window.
placement Binarysharp.MemoryManagement.Native.WindowPlacement A pointer to the structure that specifies the new show state and window positions.
return void
        public static void SetWindowPlacement(IntPtr windowHandle, WindowPlacement placement)
        {
            // Check if the handle is valid
            HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle");

            // If the debugger is attached and the state of the window is ShowDefault, there's an issue where the window disappears
            if (Debugger.IsAttached && placement.ShowCmd == WindowStates.ShowNormal)
                placement.ShowCmd = WindowStates.Restore;

            // Set the window placement
            if (!NativeMethods.SetWindowPlacement(windowHandle, ref placement))
                throw new Win32Exception("Couldn't set the window placement.");
        }

Same methods

WindowCore::SetWindowPlacement ( IntPtr windowHandle, int left, int top, int height, int width ) : void