BeginDeferWindowPos function (winuser.h)

Allocates memory for a multiple-window- position structure and returns the handle to the structure.


HDWP BeginDeferWindowPos(
  [in] int nNumWindows


[in] nNumWindows

Type: int

The initial number of windows for which to store position information. The DeferWindowPos function increases the size of the structure, if necessary.

Return value

Type: HDWP

If the function succeeds, the return value identifies the multiple-window-position structure. If insufficient system resources are available to allocate the structure, the return value is NULL. To get extended error information, call GetLastError.


The multiple-window-position structure is an internal structure; an application cannot access it directly.

DeferWindowPos fills the multiple-window-position structure with information about the target position for one or more windows about to be moved. The EndDeferWindowPos function accepts the handle to this structure and repositions the windows by using the information stored in the structure.

If the system must increase the size of the multiple-window- position structure beyond the initial size specified by the nNumWindows parameter but cannot allocate enough memory to do so, the system fails the entire window positioning sequence (BeginDeferWindowPos, DeferWindowPos, and EndDeferWindowPos). By specifying the maximum size needed, an application can detect and process failure early in the process.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows 10, version 10.0.14393)

See also