Declare Function EqualRect Lib "user32.dll" (lpRect1 As RECT, lpRect2 As RECT) As Long
Platforms: Win 32s, Win 95/98, Win NT
EqualRect determines if two rectangles are equal. Rectangles are considered equal if and only if the upper-left and lower-right corners (the points that define the rectangles) of one rectangle are equal to those of another. The function returns 1 if the two rectangles are equal and 0 if they are unequal.
Example:
' Demonstrate equal and unequal rectangles
Dim r As RECT, s As RECT ' rectangles to use
Dim areequal As Long ' receives whether the rectangles are equal or not
Dim retval As Long ' return value
' Initialize the two rectangles using the API
retval = SetRect(r, 15, 20, 100, 110) ' r = (15,20)-(100,110)
retval = SetRect(s, 15, 20, 100, 110) ' s = (15,20)-(100,110)
areequal = EqualRect(r, s) ' compare the rectangles
If areequal = 1 Then Debug.Print "Are Equal" Else Debug.Print "Are Not Equal"
' Change the second rectangle
retval = SetRect(s, 30, 45, 200, 250) ' s = (30,45)-(200,250)
areequal = EqualRect(r, s) ' compare the rectangles
If areequal = 1 Then Debug.Print "Are Equal" Else Debug.Print "Are Not Equal"
' The first time is Are Equal, the second is Are Not Equal.
See Also: CopyRect
Category: Rectangles
Go back to the alphabetical Function listing.
Go back to the Reference section index.
This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/e/equalrect.html