vendredi 4 avril 2014

Determine if scrollbar's current position is beyond maximal/minimal value


Vote count:

0




I have a treeview control that I must subclass.


One of the things I must do is to handle WM_MOUSEWHEEL, WM_HSCROLL and WM_VSCROLL properly, by discarding these messages if the user scrolls beyond the scrollbar range.


I have tried using GetScrollInfo like this:



case WM_MOUSEWHEEL:
{
// determine if treeview control has visible vertical scrollbar
LONG_PTR WindowStyle = GetWindowLongPtr( hwnd, GWL_STYLE );

if( WindowStyle & WS_VSCROLL )
{
SCROLLINFO si;

ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_ALL;

GetScrollInfo( hwnd, SB_VERT, &si );

// here is the problem: I do not know how to formulate the condition
if( /* currentPosition > Min or currentPosition < Max value */ )
return 0L; // handle it by doing nothing

// otherwise do our stuff
}
}
return 0L; // if scrollbar is not visible handle it by doing nothing


The principle is the same for all 3 messages, so I will limit this post to WM_MOUSEWHEEL only so this post can be brief.


My question is following:


How can I determine if the user scrolled beyond the maximal/minimal value ?


Thank you.


Best regards.



asked 3 mins ago






Aucun commentaire:

Enregistrer un commentaire