Windows API Guide: GetPixel Function


Declare Function GetWindowRect Lib "user32.dll" (ByVal hwnd As Long, lpRect As RECT) As Long

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

GetWindowRect reads the size and position of a window. This information is put into the variable passed as lpRect. The rectangle receives the coordinates of the upper-left and lower-right corners of the window. If the window is past one of the edges of the screen, the values will reflect that (for example, if the left edge of a window is off the screen, the rectangle's .Left property will be negative). The function returns 0 if an error occured, or 1 if successful.

hwnd
The handle of the window to read the position and width of.
lpRect
Variable that receives the coordinates of the upper-left and lower-right corners of the window.

Example:

' Display the width and height of window Form1 ' Width and height can be calculated from the coordinates returned in the rectangle. Dim r As RECT  ' receives window rectangle Dim retval As Long  ' return value retval = GetWindowRect(Form1.hWnd, r)  ' set r equal to Form1's rectangle Debug.Print "Width ="; r.Right - r.Left Debug.Print "Height ="; r.Bottom - r.Top

See Also: MoveWindow, SetWindowPos
Category: Windows

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/g/getwindowrect.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