DeferWindowPos

Version 3.0

Syntax

HANDLE DeferWindowPos(hWinPosInfo,hWnd,hWndInsertAfter,x,y,cx,cy,wFlags)

This function updates the multiple window-position data structure identified by the hWinPosInfo 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 data 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.

Parameter Type/Description  

hWinPosInfo HANDLE Identifies a multiple window-position data 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 HWND Identifies the window for which update information is to be stored in the data structure.  
hWndInsertAfter HWND Identifies the window following which the window identified by the hWnd parameter is to be updated.  
x int Specifies the x-coordinate of the window's upper-left corner.  
y int Specifies the y-coordinate of the window's upper-left corner.  
cx int Specifies the window's new width.  
cy int Specifies the window's new height.  
wFlags WORD Specifies one of eight possible 16-bit values that affect the size and position of the window. It must be one 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 hWinPosInfo 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.

If the SWP_SHOWWINDOW or the SWP_HIDEWINDOW flags are set, scrolling and moving cannot be done simultaneously.

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