Public Function NewWindowProc(ByVal hwnd As Long, ByVal msg _
As Long, ByVal wParam As Long, ByVal lParam As Long) As _
Long
Static num As Long
Const WM_NCRBUTTONDOWN = &HA4
Const WM_NCLBUTTONDOWN = &HA1
Const WM_SYSCOMMAND = &H112
Const SC_MOVE = &HF010&
Const HTBORDER = 18
Const HTBOTTOM = 15
Const HTBOTTOMLEFT = 16
Const HTBOTTOMRIGHT = 17
Const HTCAPTION = 2
Const HTCLOSE = 20
Const HTGROWBOX = 4
Const HTLEFT = 10
Const HTMAXBUTTON = 9
Const HTMINBUTTON = 8
Const HTRIGHT = 11
Const HTSYSMENU = 3
Const HTTOP = 12
Const HTTOPLEFT = 13
Const HTTOPRIGHT = 14
Dim skip_it As Boolean
If msg = WM_NCRBUTTONDOWN Then
Select Case wParam
Case HTBORDER, HTBOTTOM, _
HTBOTTOMLEFT, HTBOTTOMRIGHT, _
HTLEFT, HTRIGHT, HTTOP, _
HTTOPLEFT, HTTOPRIGHT, HTGROWBOX
' Move the form.
SendMessage hwnd, WM_SYSCOMMAND, SC_MOVE, _
ByVal 0&
skip_it = True
End Select
End If
num = num + 1
' Call the original WindowProc.
If Not skip_it Then
NewWindowProc = CallWindowProc( _
OldWindowProc, hwnd, msg, wParam, _
lParam)
End If
End Function
|