Programming » Visual Basic 6 » Visual Basic 6 Code » Forms » ");?>
Enables you to create a fake title bar or allow the user to move your form from another control.
Public Declare Sub ReleaseCapture Lib "user32" ()
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
        (ByVal hWnd As Long, _
        ByVal wMsg As Long, _
        ByVal wParam As Long, _
        lParam As Any) As Long

Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HTCAPTION = 2

'This goes in the MouseDown event of your control that you want to
' move the form with
Dim nRet As Long
If Button = vbLeftButton Then
    ReleaseCapture
    nRet = SendMessage(Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If