Windows API Guide: GetWindowTextLength Function


Declare Function IntersectRect Lib "user32.dll" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long

Platforms: Win 32s, Win 95/98, Win NT

IntersectRect creates a rectangle based on the intersecting part of two other rectangles. The rectangular region where the two source rectangles overlap is the intersection rectangle. If one or both of the source rectangles are empty or there is no intersection, the function returns 0 and the lpDestRect rectangle is set to (0,0)-(0,0). If the source rectangles do overlap, the intersection is put into lpDestRect and the function returns 1.

lpDestRect
The rectangle to be set as the intersection of the two source rectangles.
lpSrc1Rect
The first source rectangle.
lpSrc2Rect
The second source rectangle.

Example:

' Determine if windows Form1 and Form2 are overlapping on the ' screen.  If they don't the intersection rectangle will be empty. Dim intrect As RECT  ' receives the intersection rectangle Dim window1 As RECT, window2 As RECT  ' receive rectangles of Form1 and Form2 Dim result As Long  ' will be set to 0 if no intersection, 1 if there is intersection Dim retval As Long  ' return value for other functions retval = GetWindowRect(Form1.hWnd, window1)  ' get Form1's rectangle retval = GetWindowRect(Form2.hWnd, window2)  ' get Form2's rectangle result = IntersectRect(intrect, window1, window2)  ' determine the intersection rectangle If result = 0  ' in this case, intrect will also be empty   Debug.Print "Windows Form1 and Form2 are not overlapping on the screen." Else   Debug.Print "Windows Form1 and Form2 are overlapping on the screen." End If

See Also: SubtractRect, UnionRect
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/i/intersectrect.html



Windows API Guide
Windows API Guide - Reference - Volume 1: Version 3.0 For the MS-DOS and PC-DOS Operating Systems
ISBN: B001V0KQIY
EAN: N/A
Year: 1998
Pages: 610

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net