public static extern bool SetWindowPos( IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
public bool SetWindowPos( IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags) => SetWindowPos(hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags);
public static extern uint SetWindowPos( IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int width, int height, SetWindowPosFlags flags);
public static void setWindowPos(IntPtr hwnd, int x, int y, int width, int height, SetWindowPosFlags flags) { SetWindowPos(hwnd, HWND_TOP, x, y, width, height, (uint)flags); }
internal static extern bool SetWindowPos(HandleRef hWnd, HandleRef hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags flags);
public static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, SetWindowPosFlags flags) { return false; }
public static extern bool SetWindowPos(IntPtr WindowHandle, IntPtr HandleInsertAfter, Int32 x, Int32 y, Int32 Width, Int32 Height, SetWindowPosFlags uFlags);
public static extern IntPtr SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags wFlags);
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags uFlags);
static extern bool SetWindowPos(IntPtr hWnd, SpecialWindowHandles hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags uFlags);
private static extern bool SetWindowPos(HandleRef hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
/// <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()); }
internal static void SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags flags) { if (!NativeMethods.Internal.SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, flags)) { int errorCoder = Marshal.GetLastWin32Error(); if (errorCoder != 0) throw new Win32Exception(errorCoder); } }
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int w, int h, SetWindowPosFlags uFlags);
public static bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, SetWindowPosFlags flags) { return(false); }
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); }
/// <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="windowFlags">The flags to set for the window.</param> /// <returns>status of the execution</returns> public static bool SetWindowPosition(string windowName, WindowPosition position, SetWindowPosFlags windowFlags = SetWindowPosFlags.SWP_SHOWWINDOW) { if (string.IsNullOrEmpty(windowName)) { return(false); } IntPtr hWnd = FindWindow(windowName, null); if (hWnd == IntPtr.Zero) { return(false); } return(SetWindowPos(hWnd, IntPtr.Zero, position.X, position.Y, 0, 0, (uint)windowFlags)); }
public static extern IntPtr DeferWindowPos(IntPtr hWinPosInfo, IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, SetWindowPosFlags flags);
internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
public static extern int SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags uFlags);
/// <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)); }
public static bool setWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int top, int left, int width, int height, SetWindowPosFlags uFlags) { return SetWindowPos(hWnd, hWndInsertAfter, top, left, width, height, uFlags); }
internal extern static bool Win32SetWindowPos(IntPtr hWnd, SetWindowPosZOrder pos, int x, int y, int cx, int cy, SetWindowPosFlags Flags);
public static bool setWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, Rect r, SetWindowPosFlags uFlags) { return setWindowPos(hWnd, hWndInsertAfter, r.Top, r.Left, r.Width, r.Height, uFlags); }
public static extern int SetWindowPos(IntPtr hWnd, SetWindowPosZ hWndAfter, int X, int Y, int Width, int Height, SetWindowPosFlags flags);
internal static extern bool SetWindowPos( IntPtr handle, WindowPlacementOptions placement, int x, int y, int cx, int cy, SetWindowPosFlags flags );
public static extern bool SetWindowPos( IntPtr hWnd, SetWindowPosHWnd hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags uFlags );
#pragma warning restore IDE1006 public static void SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags flags) { var ret = _SetWindowPos(hWnd, hWndInsertAfter, x, y, cx, cy, flags); if (!ret) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }
internal void SetWindowPos(Window target, IntPtr intPtr, int x, int y, int cx, int cy, SetWindowPosFlags flags) { WindowInteropHelper winHelp = new WindowInteropHelper(target); var windowHanlder = winHelp.Handle; SetWindowPos(windowHanlder, intPtr, x, y, cx, cy, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE); }
static bool hSetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags) { if (!SetWindowPosHook.ImportHook) { SetWindowPosHook.Uninstall(); } bool Rst = SetWindowPos(hWnd, hWndInsertAfter, X, Y, cx, cy, uFlags); if (!SetWindowPosHook.ImportHook) { SetWindowPosHook.Install(); } ShowIntro(hWnd); return(Rst); }
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndAfter, int l, int t, int cx, int cy, SetWindowPosFlags flag);
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int left, int top, int width, int height, SetWindowPosFlags uFlags);
internal static extern bool SetWindowPos(IntPtr hwnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags wFlags);
public static extern bool SetWindowPos(IntPtr hwnd, SetWindowsPosPosition hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
//this is a child window for the whole Dialog protected override void WndProc(ref Message m) { RECT currentSize = new RECT(); const SetWindowPosFlags flags = SetWindowPosFlags.SWP_NOZORDER | SetWindowPosFlags.SWP_NOMOVE;//| SetWindowPosFlags.SWP_NOREPOSITION | SetWindowPosFlags.SWP_ASYNCWINDOWPOS | SetWindowPosFlags.SWP_SHOWWINDOW | SetWindowPosFlags.SWP_DRAWFRAME; switch ((Msg)m.Msg) { case Msg.WM_SHOWWINDOW: InitControls(); NativeMethods.GetWindowRect(new HandleRef(this, _hFileDialogHandle), ref currentSize); //restore original sizes int top = (_CustomControl.Parent == null) ? currentSize.top : _CustomControl.Parent.Top; int right = (_CustomControl.Parent == null) ? currentSize.right : _CustomControl.Parent.Right; RECT currentClientSize = new RECT(); NativeMethods.GetClientRect(new HandleRef(this, _hFileDialogHandle), ref currentClientSize); int dy = (int)(currentSize.Height - currentClientSize.Height); int dx = (int)(currentSize.Width - currentClientSize.Width); int Height = 0; int Width = 0; switch (_CustomControl.FileDlgStartLocation) { case AddonWindowLocation.Bottom: Width = Math.Max(_CustomControl.OriginalCtrlSize.Width + dx, (int)FileDialogControlBase.OriginalDlgWidth); NativeMethods.SetWindowPos(_hFileDialogHandle, (IntPtr)ZOrderPos.HWND_BOTTOM, right, top, Width, (int)currentSize.Height, flags); break; case AddonWindowLocation.Right: Height = Math.Max(_CustomControl.OriginalCtrlSize.Height + dy, (int)FileDialogControlBase.OriginalDlgHeight); NativeMethods.SetWindowPos(_hFileDialogHandle, (IntPtr)ZOrderPos.HWND_BOTTOM, right, top, (int)currentSize.Width, Height, flags); break; } break; case Msg.WM_SIZE: { NativeMethods.GetClientRect(new HandleRef(this, _hFileDialogHandle), ref currentSize); switch (_CustomControl.FileDlgStartLocation) { case AddonWindowLocation.Bottom: if (!mInitializated && FileDialogControlBase.OriginalDlgWidth == 0) { FileDialogControlBase.OriginalDlgWidth = currentSize.Width; } if (currentSize.Width != _CustomControl.Width) { _CustomControl.Width = (int)currentSize.Width; } break; case AddonWindowLocation.Right: if (!mInitializated && FileDialogControlBase.OriginalDlgHeight == 0) { FileDialogControlBase.OriginalDlgHeight = currentSize.Height; } if (currentSize.Height != _CustomControl.Height) { _CustomControl.Height = (int)currentSize.Height; } break; } } break; case Msg.WM_SIZING: NativeMethods.GetClientRect(new HandleRef(this, _hFileDialogHandle), ref currentSize); switch (_CustomControl.FileDlgStartLocation) { case AddonWindowLocation.Right: if (currentSize.Height != _CustomControl.Height) { NativeMethods.SetWindowPos(_CustomControl.Handle, (IntPtr)ZOrderPos.HWND_BOTTOM, 0, 0, (int)_CustomControl.Width, (int)currentSize.Height, UFLAGSSIZEEX); } break; case AddonWindowLocation.Bottom: if (currentSize.Height != _CustomControl.Height) { NativeMethods.SetWindowPos(_CustomControl.Handle, (IntPtr)ZOrderPos.HWND_BOTTOM, 0, 0, (int)currentSize.Width, (int)_CustomControl.Height, UFLAGSSIZEEX); } break; case AddonWindowLocation.BottomRight: if (currentSize.Width != _CustomControl.Width || currentSize.Height != _CustomControl.Height) { NativeMethods.SetWindowPos(_CustomControl.Handle, (IntPtr)ZOrderPos.HWND_BOTTOM, (int)currentSize.Width, (int)currentSize.Height, (int)currentSize.Width, (int)currentSize.Height, UFLAGSSIZEEX); } break; } break; case Msg.WM_WINDOWPOSCHANGING: if (!mIsClosing) { if (!mInitializated && !mResized) { // Resize OpenDialog to make fit our extra form WINDOWPOS pos = (WINDOWPOS)Marshal.PtrToStructure(m.LParam, typeof(WINDOWPOS)); if (pos.flags != 0 && ((pos.flags & (int)SWP_Flags.SWP_NOSIZE) != (int)SWP_Flags.SWP_NOSIZE)) { switch (_CustomControl.FileDlgStartLocation) { case AddonWindowLocation.Right: mOriginalSize = new Size(pos.cx, pos.cy); pos.cx += _CustomControl.Width; Marshal.StructureToPtr(pos, m.LParam, true); currentSize = new RECT(); NativeMethods.GetClientRect(new HandleRef(this, _hFileDialogHandle), ref currentSize); if (_CustomControl.Height < (int)currentSize.Height) { _CustomControl.Height = (int)currentSize.Height; } break; case AddonWindowLocation.Bottom: mOriginalSize = new Size(pos.cx, pos.cy); pos.cy += _CustomControl.Height; Marshal.StructureToPtr(pos, m.LParam, true); currentSize = new RECT(); NativeMethods.GetClientRect(new HandleRef(this, _hFileDialogHandle), ref currentSize); if (_CustomControl.Width < (int)currentSize.Width) { _CustomControl.Width = (int)currentSize.Width; } break; case AddonWindowLocation.BottomRight: mOriginalSize = new Size(pos.cx, pos.cy); pos.cy += _CustomControl.Height; pos.cx += _CustomControl.Width; Marshal.StructureToPtr(pos, m.LParam, true); break; } mResized = true; // Don't resize again } } } break; case Msg.WM_IME_NOTIFY: if (m.WParam == (IntPtr)ImeNotify.IMN_CLOSESTATUSWINDOW) { mIsClosing = true; NativeMethods.SetWindowPos(_hFileDialogHandle, IntPtr.Zero, 0, 0, 0, 0, UFLAGSHIDE); NativeMethods.GetWindowRect(new HandleRef(this, _hFileDialogHandle), ref _DialogWindowRect); NativeMethods.SetWindowPos(_hFileDialogHandle, IntPtr.Zero, (int)(_DialogWindowRect.left), (int)(_DialogWindowRect.top), (int)(mOriginalSize.Width), (int)(mOriginalSize.Height), FileDialogControlBase.MSFileDialogWrapper.UFLAGSSIZE); } break; case Msg.WM_PAINT: break; case Msg.WM_NCCREATE: break; case Msg.WM_CREATE: break; case Msg.WM_ACTIVATE: if (_WatchForActivate && !mIsClosing) //WM_NCACTIVATE works too { //Now the Open/Save Dialog is visible and about to enter the modal loop _WatchForActivate = false; //Now we save the real dialog window handle _hFileDialogHandle = m.LParam; ReleaseHandle(); //release the dummy window AssignHandle(_hFileDialogHandle); //assign the native open file handle to grab the messages #pragma warning disable 0197, 0414 NativeMethods.GetWindowRect(new HandleRef(this, _hFileDialogHandle), ref _CustomControl._OpenDialogWindowRect); #pragma warning restore 0197, 0414 _CustomControl._hFileDialogHandle = _hFileDialogHandle; } break; case Msg.WM_COMMAND: switch (NativeMethods.GetDlgCtrlID(m.LParam)) { case (int)ControlsId.ButtonOk: //OK break; case (int)ControlsId.ButtonCancel: //Cancel break; case (int)ControlsId.ButtonHelp: //help break; case 0: break; default: break; } //switch(NativeMethods.GetDlgCtrlID(m.LParam)) ends break; default: break; }//switch ((Msg)m.Msg) ends base.WndProc(ref m); }
public static void setWindowPos( IntPtr hwnd, int x, int y, int width, int height, SetWindowPosFlags flags ) { SetWindowPos(hwnd, HWND_TOP, x, y, width, height, (uint)flags); }
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, SetWindowPosFlags flags);
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int width, int height, SetWindowPosFlags uFlags);
internal void UpdateZOrder(int left, int top, SetWindowPosFlags flags) { User32.SetWindowPos(_handle, !IsTopMost ? _noTopMost : _yesTopMost, left, top, 0, Size, flags); User32.SetWindowPos(_handle, _parentHandle, 0, 0, 0, Size, NoSizeNoMove | SetWindowPosFlags.SWP_NOACTIVATE); }
static extern bool SetWindowPos(IntPtr handle, IntPtr insertAfterHandle, int left, int top, int width, int height, SetWindowPosFlags flags);
public static extern Int32 SetWindowPos(IntPtr hWnd, IntPtr hWndAfter, Int32 x, Int32 y, Int32 cx, Int32 cy, SetWindowPosFlags uFlags);
internal static extern bool SetWindowPos(IntPtr handle, IntPtr insertAfter, int x, int y, int cx, int cy, SetWindowPosFlags flags);
internal static extern bool SetWindowPos( IntPtr handle, IntPtr insertAfter, int x, int y, int cx, int cy, SetWindowPosFlags flags );
[DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
[DllImport("user32.dll")] public static extern bool SetWindowPos (IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);
public void SetWindowPos(SetWindowPosFlags flags) { SetWindowPos(0, 0, 0, 0, flags); }
internal extern static bool Win32SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, SetWindowPosFlags Flags);
public void SetWindowPos(Rectangle rect, SetWindowPosFlags flags) { SetWindowPos(rect.X, rect.Y, rect.Width, rect.Height, flags); }
public void SetWindowPos(int x, int y, int width, int height, SetWindowPosFlags flags) { NativeMethods.SetWindowPos(Handle, IntPtr.Zero, x, y, width, height, flags); }
public static extern int SetWindowPos( IntPtr hWnd, SetWindowPosZOrder pos, int X, int Y, int cx, int cy, SetWindowPosFlags uFlags);