Move Form Without Title Bar

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'After you Copy&Paste the following code to your form, You will be able to move it by
'clicking on it and holding the mouse button down (like WinAmp).
'Insert this code to the module :

Declare Function SendMessage Lib "User32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam _
As Long, lParam As Any) As Long
Declare Sub ReleaseCapture Lib "User32" ()
Public Const WM_NCLBUTTONDOWN = &HA1
Public Const HTCAPTION = 2

'Insert this code to your form:

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim ReturnValue As Long
If Button = 1 Then
Call ReleaseCapture
ReturnValue = SendMessage(Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&)
End If
End Sub

Go Back