home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "Module1"
- Option Explicit
-
- ' Project-specific API messages
- Public Const wm_NCHitTest = &H84
-
- ' Mouse-related API messages
- Public Const wm_MouseMove = &H200
- Public Const wm_LButtonDown = &H201
- Public Const wm_LButtonUp = &H202
- Public Const wm_LButtonDblClk = &H203
- Public Const wm_RButtonDown = &H204
- Public Const wm_RButtonUp = &H205
- Public Const wm_RButtonDblClk = &H206
- Public Const wm_MButtonDown = &H207
- Public Const wm_MButtonUp = &H208
- Public Const wm_MButtonDblClk = &H209
-
- ' Constants for wm_NCHitTest message
- Public Const htError = -2
- Public Const htTransparent = -1
- Public Const htNoWhere = 0
- Public Const htClient = 1
- Public Const htCaption = 2
- Public Const htSysMenu = 3
- Public Const htGrowBox = 4
- Public Const htSize = htGrowBox
- Public Const htMenu = 5
- Public Const htHScroll = 6
- Public Const htVScroll = 7
- Public Const htReduce = 8
- Public Const htZoom = 9
- Public Const htLeft = 10
- Public Const htRight = 11
- Public Const htTop = 12
- Public Const htTopLeft = 13
- Public Const htTopRight = 14
- Public Const htBottom = 15
- Public Const htBottomLeft = 16
- Public Const htBottomRight = 17
- Public Const htSizeFirst = htLeft
- Public Const htSizeLast = htBottomRight
-
- ' Index constants for Get/SetWindowLong
- Public Const Gwl_WndProc = -4
- Public Const Gwl_HInstance = -6
- Public Const Gwl_HWndParent = -8
- Public Const Gwl_Id = -12
- Public Const Gwl_Style = -16
- Public Const Gwl_ExStyle = -20
- Public Const Gwl_UserData = -21
-
- ' Original window procedure
- Public OldWndProc As Long
-
- Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
- (ByVal hWnd As Long, ByVal nIndex As Long) As Long
-
- Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
- (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
-
- Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
- (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, _
- ByVal wParam As Long, ByVal lParam As Long) As Long
-
- Public Function FormWindowProc(ByVal hWnd As Long, ByVal Message As Long, _
- ByVal wParam As Long, ByVal lParam As Long) As Long
- Dim hitCode As Integer
-
- If Message = wm_NCHitTest Then
- hitCode = CallWindowProc(OldWndProc, hWnd, Message, wParam, lParam)
- If hitCode = htClient Then hitCode = htCaption
- FormWindowProc = hitCode
- Else
- FormWindowProc = CallWindowProc(OldWndProc, hWnd, Message, wParam, lParam)
- End If
- End Function
-
-
-