UnionRect determines the smallest possible rectangle that contains two other rectangles. This rectangle is called the union rectangle because it is derived from the union of the areas that the two source rectangles occupy. The union rectangle is put into the variable passed as lpDestRect. The function returns 0 if an error occured, or 1 if successful.
Declare Function UnionRect Lib "user32.dll" (lpDestRect As _
RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
Variable that receives the union rectangle.
The first of the two source rectangles.
The second of the two source rectangles.
Dim s As RECT, t As RECT
Dim urect As RECT
Dim retval As Long
retval = SetRect(s, 20, 30, 60, 80)
retval = SetRect(t, 100, 110, 200, 300)
retval = UnionRect(urect, s, t)