Вопрос
Есть стандартный контрол ScrollBar. Как его научить скроллиться колесом мыши?
Ответ
Public Declare Function SetWindowLong _
Lib "user32" Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Public 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 WM_MOUSEWHEEL = &H20A
Function SwapProcAB(ByVal hwnd As Long, ByVal Msg As Long, ByVal _
wParam As Long, ByVal lParam As Long) As Long
Dim lReturn As Long
lReturn = CallWindowProc(formname.OldABProc, hwnd, Msg, wParam, lParam)
Select Case Msg
Case WM_MOUSEWHEEL
formname.ScrollFlex wParam
End Select
SwapProcAB = lReturn
End Function
в форме:
Public OldABProc As Long
Private Const GWL_WNDPROC = (-4)
Private Sub Form_Load()
…
OldABProc = SetWindowLong(Flex1.hwnd, GWL_WNDPROC, AddressOf SwapProcAB)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
…
SetWindowLong Flex1.hwnd, GWL_WNDPROC, OldABProc
End Sub
•Creator•
Copyright 2000-2004 Сообщество Чайников
Контактная информация