UnionRect function (winuser.h)

The UnionRect function creates the union of two rectangles. The union is the smallest rectangle that contains both source rectangles.

Syntax

BOOL UnionRect(
  [out] LPRECT     lprcDst,
  [in]  const RECT *lprcSrc1,
  [in]  const RECT *lprcSrc2
);

Parameters

[out] lprcDst

A pointer to the RECT structure that will receive a rectangle containing the rectangles pointed to by the lprcSrc1 and lprcSrc2 parameters.

[in] lprcSrc1

A pointer to the RECT structure that contains the first source rectangle.

[in] lprcSrc2

A pointer to the RECT structure that contains the second source rectangle.

Return value

If the specified structure contains a nonempty rectangle, the return value is nonzero.

If the specified structure does not contain a nonempty rectangle, the return value is zero.

Remarks

The system ignores the dimensions of an empty rectangle that is, a rectangle in which all coordinates are set to zero, so that it has no height or no width.

Because applications can use rectangles for different purposes, the rectangle functions do not use an explicit unit of measure. Instead, all rectangle coordinates and dimensions are given in signed, logical values. The mapping mode and the function in which the rectangle is used determine the units of measure.

Requirements

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

See also

InflateRect

IntersectRect

OffsetRect

RECT

Rectangle Functions

Rectangles Overview