I'm subclassing the hWnd of a control on a form. It's actually the ScreenDisplay-object of ArcMap: I'm developing an application in ArcGIS using ArcObjects an VB6. But never mind those specifics, it's just like a picturebox than can scroll.
I want to prevent the scrolling using the wheel on the mouse. So I tried eating the WM_MOUSEWHEEL message using this code:
Public Const WM_MOUSEWHEEL = &H20A
Public Function WindowProc(ByVal hwnd As Long, ByVal iMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
'this is my message handler
Select Case iMsg
WindowProc = False
WindowProc = CallWindowProc(ProcOld, hwnd, iMsg, wParam, lParam)
ProcOld = SetWindowLong(mpScreenDisplay.hwnd, GWL_WNDPROC, AddressOf WindowProc)
Call SetWindowLong(mpScreenDisplay.hwnd, GWL_WNDPROC, ProcOld)
I've used Spy++ to see if the WM_MOUSEWHEEL is sent, and that is the case. But the code just steps over the case statement.