IsRectEmpty Function

Declare Function IsRectEmpty Lib "user32.dll" (lpRect As RECT) As Long

IsRectEmpty checks to see if a rectangle is empty. A rectangle is considered empty if its right edge is not to the right of its left edge and/or its bottom edge is not below its top edge. For example, a rectangle (50,50)-(25,100) is empty because the right edge is to the left of the left edge. The function returns 1 if the rectangle is empty and 0 if it is not.

lpRect
The rectangle to check.

Example:

' Demonstration of empty rectangles
Dim r As RECT
' The SetRect API function is used to set the rectangle
x = SetRect(50, 50, 40, 100)  ' right edge to the left of left edge
Debug.Print IsRectEmpty(r)  ' returns 1
x = SetRect(50, 50, 100, 100)  ' rectangle is OK
Debug.Print IsRectEmpty(r)  ' returns 0
x = SetRect(50, 50, 100, 50)  ' bottom is same as top
Debug.Print IsRectEmpty(r)  ' returns 1

Related Call: SetRectEmpty
Category: Rectangles
Back to the index.


Back to Paul Kuliniewicz's Home Page
E-mail: Borg953@aol.com
This page is at http://members.aol.com/Borg953/api/functions/isrectempty.html