IntersectRect

Syntax

int IntersectRect(lpDestRect,lpSrc1Rect,lpSrc2Rect)

This function creates the intersection of two existing rectangles. The intersection is the largest rectangle contained in both rectangles. The IntersectRect function copies the new rectangle to the RECT data structure pointed to by the lpDestRect parameter.

Parameter Type/Description  

lpDestRect LPRECT Points to the RECT data structure that is to receive the intersection.  
lpSrc1Rect LPRECT Points to a RECT data structure that contains a source rectangle.  
lpSrc2Rect LPRECT Points to a RECT data structure that contains a source rectangle.  

Return Value

The return value specifies the intersection of two rectangles. It is nonzero if the intersection of the two rectangles is not empty. It is zero if the intersection is empty.