Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function allocates memory for a multiple-window position structure and returns the handle to the structure.

Syntax

HDWP BeginDeferWindowPos( 
  int 
nNumWindows 
);

Parameters

nNumWindows

[in] Specifies the initial number of windows for which to store position information. The DeferWindowPosfunction increases the size of the structure, if necessary.

Return Value

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

Code Example

Here, BeginDeferWindowPosis used to get information in order to update a window.

Copy Code
void DXView_OnSize(HWND hWnd)
{
	HDWP hDWP;
	RECT ClientRect;
	int Height;
	HWND hKeyTreeWnd, hValueListWnd;
	int x;
	int dx;
	if ((hDWP =  BeginDeferWindowPos (2)) != NULL)
	{
		GetClientRect(hWnd, &ClientRect);
...
}

Remarks

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

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

If any of the windows in the multiple-window — position structure have the SWP_HIDEWINDOW or SWP_SHOWWINDOW flag set, none of the windows are repositioned.

If the system must increase the size of the multiple-window — position structure beyond the initial size specified by the nNumWindowsparameter 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.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 2.10 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also