BOOL EqualRgn(hrgnSrc1, hrgnSrc2) | |||||
HRGN hrgnSrc1; | /* handle of first region to test for equality | */ | |||
HRGN hrgnSrc2; | /* handle of second region to test for equality | */ |
The EqualRgn function determines whether two given regions are identical.
hrgnSrc1
Identifies the first region.
hrgnSrc2
Identifies the second region.
The return value is nonzero if the two regions are equal. Otherwise, it is zero.
The following example uses the EqualRgn function to test the equality of a region against two other regions. In this case, hrgn2 is identical to hrgn1, but hrgn3 is not identical to hrgn1.
BOOL fEqual;
HRGN hrgn1, hrgn2, hrgn3;
LPSTR lpszEqual = "Regions are equal.";
LPSTR lpszNotEqual = "Regions are not equal.";
hrgn1 = CreateRectRgn(10, 10, 110, 110); /* 1 and 2 identical */
hrgn2 = CreateRectRgn(10, 10, 110, 110);
hrgn3 = CreateRectRgn(100, 100, 210, 210); /* same dimensions */
fEqual = EqualRgn(hrgn1, hrgn2);
if (fEqual)
TextOut(hdc, 10, 10, lpszEqual, lstrlen(lpszEqual));
else
TextOut(hdc, 10, 10, lpszNotEqual, lstrlen(lpszNotEqual));
fEqual = EqualRgn(hrgn1, hrgn3);
if (fEqual)
TextOut(hdc, 10, 30, lpszEqual, lstrlen(lpszEqual));
else
TextOut(hdc, 10, 30, lpszNotEqual, lstrlen(lpszNotEqual));
DeleteObject(hrgn1);
DeleteObject(hrgn2);
DeleteObject(hrgn3);