Is any way to catch events when ListView begins vertical scrolling and ends it?
First of all I tried to catch LVN_BEGINSCROLL and LVN_ENDSCROLL notifications, but the result not justified what I expected. Maybe I was wrong trying to handle these notifications (in parent form I handled WM_NOTIFY message and in it’s handler I checked Msg.NMHdr.code).
Also I tried to handle WM_VSCROLL message of my ListView and checked ScrollCode = SB_ENDSCROLL. But how to detect BeginScroll event?
And when I scrolling ListView by mouse wheel WM_VSCROLL does not come. WM_MOUSEWHEEL messages comes instead. How to detect and handle events what I need with WM_MOUSEWHEEL message? Is it possible by checking delta, that is is high-order word in wParam of WM_MOUSEWHEEL message?
Or what can I do?
Thanks.
LVN_BEGINSCROLLandLVN_ENDSCROLLwork fine for me when I try them, provided the app has XP themes enabled since they only work with ComCtrl32 v6. But their timing is different than you are expecting, which is likely what is confusing you.WM_VSCROLLby itself will work better for what you need, and it does not rely on ComCtl32 v6. It will also handle mouse wheel scrolling, though the timing of wheel begin/end scroll notifications will act more like theLVN_BEGINSCROLLandLVN_ENDSCROLLnotifications since a wheel has no idea when the next movement will occur, so each tick of the wheel is treated independantly.When using
WM_VSCROLL, you can use a boolean variable to keep track of the scrolling state so you can detect the BeginScroll, and then the message will notify you of EndScroll.Try this: