Re: Datagrid Scrollbar Capture by Andrew
Andrew
Sun Jan 23 21:08:49 CST 2005
The mouse messages don't get to the datagrid because they get to the
scrollbar control(s) it contains; you could iterate the datagrid's Controls
collection and get to them. BTW, instead of using a windows hook, you might
be able to use Application.AddMessageFilter.
"jon morgan" <jonrmorgan@ntlworld.com> wrote in message
news:eXX256VAFHA.2640@TK2MSFTNGP14.phx.gbl...
> Well I figured out how to do this. It's necessary to hook the mouse using
> the SetWindowsHookEx function. The details are explained in Stephen
> Teilhets' excellent book, SubClassing and Hooking with Visual Basic
> (ch13, pp 363-4). This method hooks the mouse at low level and by
> listening for mouse wheel messages and not passing them on (just return
> any positive value), the grid scrollbar doesn't get a look in. Remember to
> unhook the mouse when you're finished with it though as otherwise you'll
> bring back fond memories of the blue screen of death...
>
> Jon
> "jon morgan" <jonrmorgan@ntlworld.com> wrote in message
> news:Ofx%23wLTAFHA.3596@TK2MSFTNGP12.phx.gbl...
>> Hi,
>>
>> How do I stop the datagrid's vscrollbar from capturing mousewheel
>> messages?
>> Seems they don't reach the grid's wndproc -where are they handled ? I
>> need
>> to use the wheel to increment values in grid cells.
>>
>> Thanks for your help
>>
>> Jon
>>
>>
>
>