Declare Function MoveWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Platforms: Win 32s, Win 95/98, Win NT
MoveWindow moves a window to a new location. In addition to moving it, this function also changes the window's size to a new width and height. The function returns 1 if successful, or 0 if an error occured.
Example:
' Move window Form1. Set its upper-left corner to the point (200, 150).
' Change its size to a width of 175 and a height of 300.
Dim retval As Long ' return value
' Move the window and make sure it's redrawn at its new position.
retval = MoveWindow(Form1.hWnd, 200, 150, 175, 300, 1)
' (If the last value had been 0, the window would have appeared to be unmoved!)
Related Calls: GetWindowRect, SetWindowPos
Category: Windows
Back to the index.