# SubtractRect function (winuser.h)

The **SubtractRect** function determines the coordinates of a rectangle formed by subtracting one rectangle from another.

## Syntax

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

## Parameters

`[out] lprcDst`

A pointer to a RECT structure that receives the coordinates of the rectangle determined by subtracting the rectangle pointed to by *lprcSrc2* from the rectangle pointed to by *lprcSrc1*.

`[in] lprcSrc1`

A pointer to a RECT structure from which the function subtracts the rectangle pointed to by *lprcSrc2*.

`[in] lprcSrc2`

A pointer to a RECT structure that the function subtracts from the rectangle pointed to by *lprcSrc1*.

## Return value

If the resulting rectangle is empty, the return value is zero.

If the resulting rectangle is not empty, the return value is nonzero.

## Remarks

The function only subtracts the rectangle specified by *lprcSrc2* from the rectangle specified by *lprcSrc1* when the rectangles intersect completely in either the x- or y-direction. For example, if **lprcSrc1* has the coordinates (10,10,100,100) and **lprcSrc2* has the coordinates (50,50,150,150), the function sets the coordinates of the rectangle pointed to by *lprcDst* to (10,10,100,100). If **lprcSrc1* has the coordinates (10,10,100,100) and **lprcSrc2* has the coordinates (50,10,150,150), however, the function sets the coordinates of the rectangle pointed to by *lprcDst* to (10,10,50,100). In other words, the resulting rectangle is the bounding box of the geometric difference.

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 |