home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "RECTPLAY1"
- Option Explicit
-
- ' Rectplay
- '
- ' Chapter 5 demonstration of rectangle operations
-
- '--------------------------------------------------------
- '
- ' API Declarations
- '
- '-------------------------------------------------------
-
- #If Win32 Then
- ' 32 Bit declarations
- Type RECT
- left As Long
- top As Long
- right As Long
- bottom As Long
- End Type
-
- Type POINTAPI
- X As Long
- Y As Long
- End Type
-
- Declare Function SetRect Lib "user32" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
- Declare Function SetRectEmpty Lib "user32" (lpRect As RECT) As Long
- Declare Function CopyRect Lib "user32" (lpDestRect As RECT, lpSourceRect As RECT) As Long
- Declare Function InflateRect Lib "user32" (lpRect As RECT, ByVal X As Long, ByVal Y As Long) As Long
- Declare Function IntersectRect Lib "user32" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
- Declare Function UnionRect Lib "user32" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
- Declare Function SubtractRect Lib "user32" (lprcDst As RECT, lprcSrc1 As RECT, lprcSrc2 As RECT) As Long
- Declare Function OffsetRect Lib "user32" (lpRect As RECT, ByVal X As Long, ByVal Y As Long) As Long
- Declare Function IsRectEmpty Lib "user32" (lpRect As RECT) As Long
- Declare Function EqualRect Lib "user32" (lpRect1 As RECT, lpRect2 As RECT) As Long
- Declare Function PtInRect Lib "user32" (lpRect As RECT, ByVal ptx As Long, ByVal pty As Long) As Long
-
- #Else
- ' 16 bit declarations
- Type RECT
- left As Integer
- top As Integer
- right As Integer
- bottom As Integer
- End Type
-
- Type POINTAPI
- X As Integer
- Y As Integer
- End Type
-
- Declare Sub SetRect Lib "User" (lpRect As RECT, ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer)
- Declare Sub SetRectEmpty Lib "User" (lpRect As RECT)
- Declare Function CopyRect Lib "User" (lpDestRect As RECT, lpSourceRect As RECT) As Integer
- Declare Sub InflateRect Lib "User" (lpRect As RECT, ByVal X As Integer, ByVal Y As Integer)
- Declare Function IntersectRect Lib "User" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Integer
- Declare Function UnionRect Lib "User" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Integer
- Declare Sub OffsetRect Lib "User" (lpRect As RECT, ByVal X As Integer, ByVal Y As Integer)
- Declare Function IsRectEmpty Lib "User" (lpRect As RECT) As Integer
- Declare Function EqualRect Lib "User" (lpRect1 As RECT, lpRect2 As RECT) As Integer
- Declare Function PtInRect Lib "User" (lpRect As RECT, ByVal pty As Integer, ByVal ptx As Integer) As Integer
- Declare Function PtInRectByNum Lib "User" Alias "PtInRect" (lpRect As RECT, ByVal ptRect As Long) As Integer
-
- #End If
-
-
- '--------------------------------------------------------
- '
- ' Application Globals
- '
- '-------------------------------------------------------
-
- ' Global rectangles
-
- Global Rect1 As RECT
- Global Rect2 As RECT
- Global RectUnion As RECT
- Global RectIntersect As RECT
-
- Global SettingState% ' 0 = Point detect mode
- ' 1 = Setting rect1
- ' 2 = Setting rect2
-
- Global StartPoint As POINTAPI
- Global EndPoint As POINTAPI
- Global HasCapture% ' Indicates that tracking is in effect
-
-