Exemple #1
0
 public static extern bool SetWindowPos(IntPtr hWnd, SpecialWindowHandles hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
Exemple #2
0
 public void SetWindowPos(SpecialWindowHandles specialWindowHandles, SetWindowPosFlags flags)
 {
     SetWindowPos(specialWindowHandles, 0, 0, 0, 0, flags);
 }
Exemple #3
0
 public void SetWindowPos(SpecialWindowHandles specialWindowHandles, int x, int y, int width, int height, SetWindowPosFlags flags)
 {
     NativeMethods.SetWindowPos(Handle, (IntPtr)specialWindowHandles, x, y, width, height, flags);
 }
Exemple #4
0
 private static extern bool SetWindowPos(IntPtr hWnd, SpecialWindowHandles hWndInsertAfter, int x, int y, int width, int height, WindowPosFlags flags);
        /// <summary>
        /// Sets the window position of a specified window.
        /// </summary>
        /// <param name="windowName">The name of the window to set the position to.</param>
        /// <param name="position">The positional coordinates, in <see cref="WindowPosition"/> struct.</param>
        /// <param name="specialWindowHandle">Used to pass any special handles for the window on the unmanaged function.</param>
        /// <param name="windowFlags">The flags to set for the window.</param>
        /// <returns>status of the execution</returns>
        public static bool SetWindowPosition(string windowName, WindowPosition position, SpecialWindowHandles specialWindowHandle, SetWindowPosFlags windowFlags = SetWindowPosFlags.SWP_SHOWWINDOW)
        {
            if (string.IsNullOrEmpty(windowName))
            {
                return(false);
            }

            IntPtr hWnd = FindWindow(windowName, null);
            IntPtr specialWindowHandlePtr = specialWindowHandle != SpecialWindowHandles.HWND_EMPTY ? (IntPtr)specialWindowHandle : IntPtr.Zero;

            if (hWnd == IntPtr.Zero)
            {
                return(false);
            }

            return(SetWindowPos(hWnd, specialWindowHandlePtr, position.X, position.Y, 0, 0, (uint)windowFlags));
        }
Exemple #6
0
 static extern bool SetWindowPos(IntPtr hWnd, SpecialWindowHandles hWndInsertAfter,
     int x, int y, int cx, int cy, SetWindowPosFlags uFlags);
Exemple #7
0
 /// <summary>
 ///     Changes the size, position, and Z order of a child, pop-up, or top-level window. These windows are
 ///     ordered according to their appearance on the screen. The topmost window receives the highest rank and
 ///     is the first window in the Z order.
 /// </summary>
 /// <param name="hWnd">A handle to the window.</param>
 /// <param name="specialHndl">A handle to the window to precede the positioned window in the Z order.</param>
 /// <param name="x">The new position of the left side of the window, in client coordinates.</param>
 /// <param name="y">The new position of the top of the window, in client coordinates.</param>
 /// <param name="width">The new width of the window, in pixels.</param>
 /// <param name="height">The new height of the window, in pixels.</param>
 /// <param name="posFlags">The window sizing and positioning flags.</param>
 public static void SetWindowPosition(IntPtr hWnd, SpecialWindowHandles specialHndl, int x, int y, int width,
     int height, SetWindowPosFlags posFlags)
 {
     if (!SetWindowPos(hWnd, specialHndl, x, y, width, height, posFlags))
         throw new Win32Exception(Marshal.GetLastWin32Error());
 }
Exemple #8
0
 /// <summary>
 ///     Changes the Z order of a child, pop-up, or top-level window. These windows are ordered according
 ///     to their appearance on the screen. The topmost window receives the highest rank and is the first
 ///     window in the Z order.
 /// </summary>
 /// <param name="hWnd">A handle to the window.</param>
 /// <param name="specialHndl">A handle to the window to precede the positioned window in the Z order.</param>
 public static void SetWindowPosition(IntPtr hWnd, SpecialWindowHandles specialHndl)
 {
     SetWindowPosition(hWnd, specialHndl, 0, 0, 0, 0, SetWindowPosFlags.NoMove | SetWindowPosFlags.NoSize);
 }