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_NCLBUTTONDOWN = &HA1
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_NCLBUTTONDOWN Then
Select Case wParam
Case HTBORDER, HTBOTTOM, _
HTBOTTOMLEFT, HTBOTTOMRIGHT, _
HTLEFT, HTRIGHT, HTTOP, _
HTTOPLEFT, HTTOPRIGHT, HTGROWBOX
' Move the form.
ReleaseCapture
SendMessage hwnd, WM_NCLBUTTONDOWN, _
HTCAPTION, 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
|