Moving Form By Dragging

Private Declare Sub ReleaseCapture Lib “user32″ ()
Private Declare Function SendMessage Lib _
“user32″ Alias “SendMessageA” (ByVal hwnd As Long, _
  ByVal wMsg As Long, ByVal wParam As Integer, _
  ByVal lParam As Long) As Long

Public Sub FormDrag(theForm As Form)
  ReleaseCapture
  Call SendMessage(theForm.hwnd, &HA1, 2, 0&)
End Sub

Private Sub Form_MouseDown(Button AsInteger, _
Shift As Integer, X AsSingle, Y As Single)

  FormDrag Me ”Dragging
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *