DeferWindowPos

  HDWP DeferWindowPos(hdwp, hwnd, hwndInsertAfter, x, y, cx, cy, dwFlags)    
  HDWP hdwp; /* handle of internal structure */
  HWND hwnd; /* handle of window to position */
  HWND hwndInsertAfter; /* placement-order handle */
  int x; /* horizontal position */
  int y; /* vertical position */
  int cx; /* width */
  int cy; /* height */
  UINT dwFlags; /* window-positioning flags */

This function updates the multiple window-position structure identified by the hdwp parameter for the window identified by hwnd parameter and returns the handle of the updated structure. The EndDeferWindowPos function uses the information in this structure to change the position and size of a number of windows simultaneously. The BeginDeferWindowPos function creates the multiple window-position structure used by this function.

The x and y parameters specify the new position of the window, and the cx and cy parameters specify the new size of the window.

Parameters

hdwp

Identifies a multiple window-position structure that contains size and position information for one or more windows. This structure is returned by the BeginDeferWindowPos function or the most recent call to the DeferWindowPos function.

hwnd

Identifies the window for which update information is to be stored in the structure.

hwndInsertAfter

Identifies the window following which the window identified by the hwnd parameter is to be updated.

x

Specifies the x-coordinate of the window's upper-left corner.

y

Specifies the y-coordinate of the window's upper-left corner.

cx

Specifies the window's new width.

cy

Specifies the window's new height.

dwFlags

Specifies one of eight possible values that affect the size and position of the window. This parameter can be some combination of the following values:

Value Meaning

SWP_DRAWFRAME Draws a frame (defined in the window's class description) around the window.
SWP_HIDEWINDOW Hides the window.
SWP_NOACTIVATE Does not activate the window.
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 the hwndInsertAfter parameter).
SWP_SHOWWINDOW Displays the window.

Return Value

The return value identifies the updated multiple window-position data structure. The handle returned by this function may differ from the handle passed to the function as the hdwp parameter. The new handle returned by this function should be passed to the next call to DeferWindowPos or the EndDeferWindowPos function.

The return value is NULL if insufficient system resources are available for the function to complete successfully.

Comments

If the SWP_NOZORDER flag is not specified, Windows places the window identified by the hwnd parameter in the position following the window identified by the hwndInsertAfter parameter. If hwndInsertAfter is NULL, Windows places the window identified by hwnd at the top of the list. If hwndInsertAfter is set to 1, Windows places the window identified by hwnd at the bottom of the list.

This statement is incorrect; if either of these two flags is set, DeferWindowPos will neither move nor size the windows. Use the ShowWindow() function to show or hide windows.

If either the SWP_SHOWWINDOW or the SWP_HIDEWINDOW flag is set, DeferWindowPos will not move or size the windows. Use the ShowWindow function to show or hide windows.

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

See Also

BeginDeferWindowPos, EndDeferWindowPos