Windows API Guide: mciGetErrorString Function


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

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

OffsetRect changes the position of a rectangle without changing its size. If the value to move by is negative, the rectangle is moved left or up (depending on the direction); positive values move it right or down. The function returns 0 if an error occured, or 1 if successful.

lpRect
The rectangle to move.
x
The value to move the rectangle horizontally by. Negative values move to the left, positive to the right.
y
The value to move the rectangle vertically by. Negative values move up, positive down.

Example:

' Shift window Form1 50 pixels right and 20 pixels up using its rectangle. Dim winrect As RECT  ' receives the rectangle of the window Dim retval As Long  ' return value retval = GetWindowRect(Form1.hWnd, winrect)  ' get Form1's rectangle retval = OffsetRect(winrect, 50, -20)  ' shift the rectangle 50 to the right and 20 upwards ' Now change the window on screen to match its new rectangle retval = SetWindowPos(Form1.hWnd, 0, winrect.Left, winrect.Top, winrect.Right, winrect.Bottom, 0)

See Also: InflateRect
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/o/offsetrect.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