Click here to Skip to main content
15,908,274 members

Comments by olid4 (Top 7 by date)

olid4 20-Jan-14 1:57am View    
Yes, I have already tried this once and it worked quite well. But I thought there could be a better and easier way, because this isn't very precisely:

return !(Rect.Height() > GetCount() * GetItemHeight(0) + (CBI.rcButton.bottom - CBI.rcButton.top) + 4);
olid4 17-Jan-14 8:54am View    
BOOL HasVertScrollbar() const
{
bool bVisible = false;

if( GetLBox().GetStyle() & WS_VSCROLL )
{
SCROLLBARINFO sbInfo;
sbInfo.cbSize = sizeof( SCROLLBARINFO );

if( GetLBox().GetScrollBarInfo( OBJID_VSCROLL, &sbInfo ) )
{
// Index 0 = Scrollbar
if( ( sbInfo.rgstate[0] & ( STATE_SYSTEM_INVISIBLE | STATE_SYSTEM_UNAVAILABLE ) ) == 0 )
{
bVisible = true;
}
}
}
else
{
CWnd* pScrollWnd = GetLBox().GetScrollBarCtrl( SB_VERT );

if( pScrollWnd && pScrollWnd->IsKindOf( RUNTIME_CLASS( CScrollBar ) ) )
{
if( pScrollWnd->IsWindowVisible() )
{
bVisible = true;
}
}
}

return bVisible;
}

returns always that a scrollbar is visible even when there's no scrollbar visible
olid4 17-Jan-14 7:59am View    
Your updated Code always sais false in my case, because GetScrollBarCtrl returns always 0x00.
olid4 17-Jan-14 7:55am View    
Sorry again!
=> Updated!
olid4 17-Jan-14 7:29am View    
I updated my question.
I will try to work with GetScrollBarCtrl().