Windows API Guide: close MCI Command String


Declare Function PtInRect Lib "user32.dll" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As Long

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

PtInRect determines if a point lies inside or outside of a rectangle. Note that Windows considers the left and top edges of a rectangle to be inside it, and the right and bottom edges to be outside. The function returns 1 if the point is inside or 0 if it is outside.

lpRect
The rectangle to look inside.
x
The x coordinate of the point to determine if it is inside or outside.
y
The y coordinate of the point to determine if it is inside or outside.

Example:

' Determine if the mouse cursor is inside or outside of window Form1. ' This is done by checking the point of the mouse cursor with the rectangle of the window. Dim mousept As POINT_TYPE  ' receives mouse coordinate Dim winrect As RECT  ' receives rectangle of Form1 Dim isinside As Long  ' receives 1 if inside or 0 if outside Dim retval As Long  ' return value for other functions retval = GetCursorPos(mousept)  ' determine the mouse cursor's position retval = GetWindowRect(Form1.hWnd, winrect)  ' determine Form1's rectangle ' Check to see if the mouse cursor is located inside of the Form1 rectangle isinside = PtInRect(winrect, mousept.x, mousept.y) If isinside = 1 Then   Debug.Print "The mouse cursor is currently inside of Form1." Else   Debug.Print "The mouse cursor is currently outside of Form1." End If

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/p/ptinrect.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