UnionRect

2.x

  BOOL UnionRect(lprcDst, lprcSrc1, lprcSrc2)    
  RECT FAR* lprcDst; /* address of structure for union */
  const RECT FAR* lprcSrc1; /* address of structure with 1st rect. */
  const RECT FAR* lprcSrc2; /* address of structure with 2nd rect. */

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

Parameters

lprcDst

Points to a RECT structure to receive a rectangle containing the rectangles pointed to by the lprcSrc1 and lprcSrc2 parameters. The RECT structure has the following form:

typedef struct tagRECT {    /* rc */
   int left;
   int top;
   int right;
   int bottom;
} RECT;

For a full description of this structure, see the Microsoft Windows Programmer's Reference, Volume 3.

lprcSrc1

Points to a RECT structure that contains the first source rectangle.

lprcSrc2

Points to a RECT structure that contains the second source rectangle.

Return Value

The return value is nonzero if the function is successful—that is, if the lprcDst parameter contains a nonempty rectangle. It is zero if the rectangle is empty or an error occurs.

Comments

Windows ignores the dimensions of an empty rectangle—that is, a rectangle that has no height or no width.

See Also

InflateRect, IntersectRect, OffsetRect, SubtractRect