Windows API Guide: SetCapture Function


Declare Function SetWindowPos Lib "user32.dll" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

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

SetWindowPos moves a window to a new location on the screen. Its physical coordinates, dimensions, and Z-order position (the Z-order determines which windows are on top of others) can be set. The function returns 0 if an error occured or 1 if successful.

hwnd
The handle of the window to move.
hWndInsertAfter
Either the handle of the window to position this window behind, or exactly one of the following flags stating where in the Z-order to put the window:
HWND_BOTTOM = 1
Put the window at the bottom of the Z-order.
HWND_NOTOPMOST = -2
Put the window below all topmost windows and above all non-topmost windows.
HWND_TOP = 0
Put the window at the top of the Z-order.
HWND_TOPMOST = -1
Make the window topmost (above all other windows) permanently.
x
The x coordinate of where to put the upper-left corner of the window.
y
The y coordinate of where to put the upper-left corner of the window.
cx
The x coordinate of where to put the lower-right corner of the window.
cy
The y coordinate of where to put the lower-right corner of the window.
wFlags
Zero or more of the following flags stating how to move the window:
SWP_DRAWFRAME = &H20
Same as SWP_FRAMECHANGED.
SWP_FRAMECHANGED = &H20
Fully redraw the window in its new position.
SWP_HIDEWINDOW = &H80
Hide the window from the screen.
SWP_NOACTIVATE = &H10
Do not make the window active after moving it unless it was already the active window.
SWP_NOCOPYBITS = &H100
Do not redraw anything drawn on the window after it is moved.
SWP_NOMOVE = &H2
Do not move the window.
SWP_NOSIZE = &H1
Do not resize the window.
SWP_NOREDRAW = &H8
Do not remove the image of the window in its former position, effectively leaving a ghost image on the screen.
SWP_NOZORDER = &H4
Do not change the window's position in the Z-order.
SWP_SHOWWINDOW = &H40
Show the window if it is hidden.

Example:

' Move window Form1 to the upper-left corner of the screen and make ' at appear above all other windows permanently.  Note how the function is told not ' to resize the window, so we don't have to worry about the lower-right coordinate. Dim flags As Long  ' the flags specifying how to move the window Dim retval As Long  ' return value ' Do not resize the window, redraw the window in its new location flags = SWP_NOSIZE Or SWP_DRAWFRAME retval = SetWindowPos(Form1.hWnd, HWND_TOPMOST, 0, 0, 1, 1, flags)  ' move the window

See Also: BringWindowToTop, GetWindowRect, MoveWindow
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/s/setwindowpos.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