# Function Reference

# _WinAPI_SubtractRect

Determines the coordinates of a rectangle formed by subtracting one rectangle from another

#include <WinAPIGdi.au3>
_WinAPI_SubtractRect ( $tRECT1, $tRECT2 )

## Parameters

$tRECT1 | $tagRECT structure from which the function subtracts the rectangle specified by $tRECT2.
$tRECT2 | $tagRECT structure that the function subtracts from the rectangle specified by $tRECT1.

## Return Value

Success: | $tagRECT structure that contains the rectangle determined by subtracting the rectangle specified by $tRECT2 from the rectangle specified by $tRECT1.
Failure: | Sets the @error flag to non-zero.

## Remarks

The function only subtracts the rectangle specified by $tRECT2 from the rectangle specified by $tRECT1 when the
rectangles intersect completely in either the x- or y-direction. For example, if $tRECT1 has the coordinates
(10, 10, 100, 100) and $tRECT2 has the coordinates (50, 50, 150, 150), the function returns the rectangle with
the coordinates (10, 10, 100, 100). If $tRECT1 has the coordinates (10, 10, 100, 100) and $tRECT2 has the
coordinates (50, 10, 150, 150), however, the function returns the rectangle with the coordinates (10, 10, 50, 100).
In other words, the resulting rectangle is the bounding box of the geometric difference.

## See Also

Search SubtractRect in MSDN Library.