VB Code:
  1. Option Explicit
  2.  
  3. Private Declare Function ReleaseCapture Lib "user32" () As Long
  4. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  5.  
  6. Const WM_NCLBUTTONDOWN As Long = &HA1
  7. Const HTCAPTION As Long = 2
  8.  
  9. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  10.     Dim lngReturnValue As Long
  11.     If Button = vbLeftButton Then
  12.         Call ReleaseCapture
  13.         lngReturnValue = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
  14.     End If
  15. End Sub