CWnd::SetWindowPos

Syntax

void SetWindowPos( const CWnd* pWndInsertAfter, int x, int y, int cx, int cy, UINT nFlags );

Parameters

pWndInsertAfter

Identifies a CWnd in the window-manager's list that will precede the positioned window.

x

Specifies the x-coordinate of the new upper-left corner.

y

Specifies the y-coordinate of the new upper-left corner.

cx

Specifies the new window's width.

cy

Specifies the new window's height.

nFlags

Specifies sizing and positioning options. It can be a combination of the following values:

Value Meaning

SWP_DRAWFRAME Draws a frame (defined in the CWnd class description) around the window.
SWP_HIDEWINDOW Hides the CWnd.
SWP_NOACTIVATE Does not activate the CWnd.
SWP_NOMOVE Retains current position (ignores the x and y parameters).
SWP_NOREDRAW Does not redraw changes.
SWP_NOSIZE Retains current size (ignores the cx and cy parameters).
SWP_NOZORDER Retains current ordering (ignores pWndInsertAfter).
SWP_SHOWWINDOW Displays the CWnd.

Remarks

Changes the size, position, and ordering of child, pop-up, and top-level windows. Child, pop-up, and top-level windows are ordered according to their appearance on the screen; the topmost window receives the highest rank, and it is the first window in the list. This ordering is recorded in a window list.

If the SWP_NOACTIVATE flag is not specified, the pWndInsertAfter parameter is ignored and CWnd is activated and placed at the top of the Z order, in front of any other windows.

If the SWP_NOZORDER flag is not specified, Windows places CWnd in the position following the window identified by pWndInsertAfter. If pWndInsertAfter is &wndTop, Windows places CWnd at the top of the list. If pWndInsertAfter is set to &wndBottom, Windows places CWnd at the bottom of the list.

If the SWP_SHOWWINDOW or the SWP_HIDEWINDOW flag is set, CWnd cannot be moved or sized.

All coordinates for child windows are relative to the upper-left corner of the parent window's client area.

See Also

::DeferWindowsPos, ::SetWindowPos