用法:调用EnableMouseWheel使特定控件支持滚轮消息。滚轮消息发生后,Ctrl.OnMouseWheelCallBack会被调用。
OnMouseWheelCallBack的参数列表必须是(ByVal hWnd As Long, ByVal Delta As Long, ByVal X As Long, ByVal Y As Long)
你可以在一个Form窗体里写这个过程,就像这样:
Sub OnMouseWheelCallBack(ByVal hWnd As Long, ByVal Delta As Long, ByVal X As Long, ByVal Y As Long)
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private 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
Private Const GWL_WNDPROC = (-4)
Private Const WM_MOUSEWHEEL = &H20A
Private m_Ctrls() As CtrlWndProcData_t
Private m_NbCtrls As Long
Private m_MaxCtrls As Long
Private Const m_NbCtrlsAlloc As Long = 8
'启用特定控件、窗体对鼠标滚轮事件的支持
'调用后,如果发生了鼠标滚轮事件,Ctrl.OnMouseWheelCallBack会被调用。
'OnMouseWheelCallBack的参数列表必须是(ByVal hWnd As Long, ByVal Delta As Long, ByVal X As Long, ByVal Y As Long)
Sub EnableMouseWheel(Ctrl As Object, ByVal hWnd As Long)