Caption = "This sample shows how you can have a caption-less window and still be able to move it with the left mouse button. This sample traps the WM_NCHITTEST message to perform this function."
Height = 885
Left = 870
TabIndex = 1
Top = 480
Width = 4755
End
Begin Label Label1
Caption = "Use the left mouse button anywhere on this form to drag the window. Click once on the right mouse button anywhere on the form to close this window."
Height = 705
Left = 870
TabIndex = 0
Top = 1830
Width = 4755
End
End
Option Explicit
Const WM_CLOSE = &H10
Const WM_NCCREATE = &H81
Const WM_NCDESTROY = &H82
Const WM_NCCALCSIZE = &H83
Const WM_NCHITTEST = &H84
Const WM_NCPAINT = &H85
Const WM_NCACTIVATE = &H86
Const WM_GETDLGCODE = &H87
Const WM_NCMOUSEMOVE = &HA0
Const WM_NCLBUTTONDOWN = &HA1
Const WM_NCLBUTTONUP = &HA2
Const WM_NCLBUTTONDBLCLK = &HA3
Const WM_NCRBUTTONDOWN = &HA4
Const WM_NCRBUTTONUP = &HA5
Const WM_NCRBUTTONDBLCLK = &HA6
Const WM_NCMBUTTONDOWN = &HA7
Const WM_NCMBUTTONUP = &HA8
Const WM_NCMBUTTONDBLCLK = &HA9
'WM_NCHITTEST return codes
Const HTERROR = (-2)
Const HTTRANSPARENT = (-1)
Const HTNOWHERE = 0
Const HTCLIENT = 1
Const HTCAPTION = 2
Const HTSYSMENU = 3
Const HTSIZE = 4
Const HTMENU = 5
Const HTHSCROLL = 6
Const HTVSCROLL = 7
Const HTMINBUTTON = 8
Const HTMAXBUTTON = 9
Const HTLEFT = 10
Const HTRIGHT = 11
Const HTTOP = 12
Const HTTOPLEFT = 13
Const HTTOPRIGHT = 14
Const HTBOTTOM = 15
Const HTBOTTOMLEFT = 16
Const HTBOTTOMRIGHT = 17
Const HTBORDER = 18
Const HTGROWBOX = HTSIZE
Const HTREDUCE = HTMINBUTTON
Const HTZOOM = HTMAXBUTTON
Sub Form_Load ()
VBMsg1.SubClasshWnd = Form1.hWnd
End Sub
Sub VBMsg1_WindowMessage (hWindow As Integer, Msg As Integer, wParam As Integer, lParam As Long, RetVal As Long, CallDefProc As Integer)