MoveWindow (user32)
Last changed: -67.166.68.151

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth,
   int nHeight, bool bRepaint);

C++ Signature:

[DllImport("User32.dll")]
static bool MoveWindow(IntPtr handle, int x, int y, int width, int height, bool redraw);

VB.NET

<DllImport("user32.dll")>_
Shared Function MoveWindow(ByVal hWnd As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, _
                           ByVal nHeight As Integer, ByVal bRepaint As Boolean) As Boolean

End Function

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

    Public Declare Auto Function MoveWindow Lib "user32.dll" ( _
    ByVal hWnd As IntPtr, _
    ByVal X As Int32, _
    ByVal Y As Int32, _
    ByVal nWidth As Int32, _
    ByVal nHeight As Int32, _
    ByVal bRepaint As Boolean _
    ) As Boolean

    Private Sub ResizeMe_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ResizeMe.MouseMove

    If e.Button = MouseButtons.Left Then

    MoveWindow(Me.Handle, Me.Location.X, Me.Location.Y, (Control.MousePosition.X - (Me.Left)) + 10, (Control.MousePosition.Y - Me.Top) + 10, True)
    Me.Refresh()
    System.Windows.Forms.Application.DoEvents()

    End If

contributed by http://kaleemsoft.com

Alternative Managed API:

Do you know one? Please contribute it!

Documentation
MoveWindow on MSDN