GetWindowRgnBox function

The GetWindowRgnBox function retrieves the dimensions of the tightest bounding rectangle for the window region of a window.


int GetWindowRgnBox(
  HWND   hWnd,
  LPRECT lprc



Handle to the window.


Pointer to a RECT structure that receives the rectangle dimensions, in device units relative to the upper-left corner of the window.

Return Value

The return value specifies the type of the region that the function obtains. It can be one of the following values.

Value Meaning
COMPLEXREGION The region is more than one rectangle.
ERROR The specified window does not have a region, or an error occurred while attempting to return the region.
NULLREGION The region is empty.
SIMPLEREGION The region is a single rectangle.


The window region determines the area within the window where the system permits drawing. The system does not display any portion of a window that lies outside of the window region. The coordinates of a window's window region are relative to the upper-left corner of the window, not the client area of the window.

To set the window region of a window, call the SetWindowRgn function.


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

See Also



Painting and Drawing Functions

Painting and Drawing Overview