[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'InterfaceBase' (#lcl)

# TWidgetSet.SetWindowPos

Changes the size, position, and Z order of a window.

## Declaration

Source position: winapih.inc line 269

`public function TWidgetSet.SetWindowPos(`
`hWnd: HWND;`
`hWndInsertAfter: HWND;`
`X: Integer;`
`Y: Integer;`
`cx: Integer;`
`cy: Integer;`
`uFlags: UINT`
`):Boolean; virtual;`

## Arguments

`hWnd` |  | The window handle.
`hWndInsertAfter` |  | The window handle or Z order position.
`X` |  | The window origin.
`Y` |  | The window origin.
`cx` |  | The window extent.
`cy` |  | The window extent.
`uFlags` |  | General placement flags.

## Function result

Zero on failure.

## Description

The Z order can be changed to just behind another window, or:

HWND_BOTTOM
  Behind all other windows.
HWND_NOTOPMOST
  Behind all topmost windows.
HWND_TOP
  Above all other windows.
HWND_TOPMOST
  Above all other non-topmost windows.

The general placement can be a combination of:

SWP_ASYNCWINDOWPOS
  Don't block the calling thread when the window is owned by a different thread.
SWP_DEFERERASE
  Suppress WM_SYNCPAINT message.
SWP_DRAWFRAME
  Draw the window frame.
SWP_FRAMECHANGED
  Apply new frame style.
SWP_HIDEWINDOW
  Hides the window.
SWP_NOACTIVATE
  Don't activate the window.
SWP_NOCOPYBITS
  Invalidate the entire client area. If not set, the window content moves together with the window.
SWP_NOMOVE
  The position is not changed (ignores X, Y).
SWP_NOREPOSITION, SWP_NOOWNERZORDER
  The Z order of the owner window is unchanged.
SWP_NOREDRAW
  Nothing is redrawn automatically, not even uncovered parts of the window.
SWP_NOSENDCHANGING
  No WM_WINDOWPOSCHANGING message.
SWP_NOSIZE
  The size is unchanged (ignores cx, cy).
SWP_NOZORDER
  The Z order is unchanged (ignores hWndInsertAfter)
SWP_SHOWWINDOW
  Unhide the window.