home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1997 August / pcpro-0897.iso / code / ProDemo2.bas < prev    next >
Encoding:
BASIC Source File  |  1997-05-07  |  2.5 KB  |  80 lines

  1. Attribute VB_Name = "Module1"
  2. Option Explicit
  3.  
  4. ' Project-specific API messages
  5. Public Const wm_NCHitTest = &H84
  6.  
  7. ' Mouse-related API messages
  8. Public Const wm_MouseMove = &H200
  9. Public Const wm_LButtonDown = &H201
  10. Public Const wm_LButtonUp = &H202
  11. Public Const wm_LButtonDblClk = &H203
  12. Public Const wm_RButtonDown = &H204
  13. Public Const wm_RButtonUp = &H205
  14. Public Const wm_RButtonDblClk = &H206
  15. Public Const wm_MButtonDown = &H207
  16. Public Const wm_MButtonUp = &H208
  17. Public Const wm_MButtonDblClk = &H209
  18.  
  19. ' Constants for wm_NCHitTest message
  20. Public Const htError = -2
  21. Public Const htTransparent = -1
  22. Public Const htNoWhere = 0
  23. Public Const htClient = 1
  24. Public Const htCaption = 2
  25. Public Const htSysMenu = 3
  26. Public Const htGrowBox = 4
  27. Public Const htSize = htGrowBox
  28. Public Const htMenu = 5
  29. Public Const htHScroll = 6
  30. Public Const htVScroll = 7
  31. Public Const htReduce = 8
  32. Public Const htZoom = 9
  33. Public Const htLeft = 10
  34. Public Const htRight = 11
  35. Public Const htTop = 12
  36. Public Const htTopLeft = 13
  37. Public Const htTopRight = 14
  38. Public Const htBottom = 15
  39. Public Const htBottomLeft = 16
  40. Public Const htBottomRight = 17
  41. Public Const htSizeFirst = htLeft
  42. Public Const htSizeLast = htBottomRight
  43.  
  44. ' Index constants for Get/SetWindowLong
  45. Public Const Gwl_WndProc = -4
  46. Public Const Gwl_HInstance = -6
  47. Public Const Gwl_HWndParent = -8
  48. Public Const Gwl_Id = -12
  49. Public Const Gwl_Style = -16
  50. Public Const Gwl_ExStyle = -20
  51. Public Const Gwl_UserData = -21
  52.  
  53. ' Original window procedure
  54. Public OldWndProc As Long
  55.  
  56. Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
  57.         (ByVal hWnd As Long, ByVal nIndex As Long) As Long
  58.         
  59. Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
  60.         (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  61.  
  62. Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _
  63.         (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, _
  64.         ByVal wParam As Long, ByVal lParam As Long) As Long
  65.  
  66. Public Function FormWindowProc(ByVal hWnd As Long, ByVal Message As Long, _
  67.                    ByVal wParam As Long, ByVal lParam As Long) As Long
  68.     Dim hitCode As Integer
  69.  
  70.     If Message = wm_NCHitTest Then
  71.         hitCode = CallWindowProc(OldWndProc, hWnd, Message, wParam, lParam)
  72.         If hitCode = htClient Then hitCode = htCaption
  73.         FormWindowProc = hitCode
  74.     Else
  75.         FormWindowProc = CallWindowProc(OldWndProc, hWnd, Message, wParam, lParam)
  76.     End If
  77. End Function
  78.  
  79.  
  80.