I have a class that is derived from a CListCtrl. I want the widths of all the columns to total the width of the display Window, so that I don't get the bottom scrollbar. I can get the width of standard scrollbars vai the GetSystemMetrics(SM_CXVSCROLL)
call, but I don't know how to tell if the vertical scrollbar is active. I've tried to use:
auto pScrollbar = GetScrollBarCtrl(SB_VERT);
auto is_visible = pScrollbar && pScrollbar->IsWindowVisible();
But pScrollbar
is always a nullptr
. I've looked around and some ppl are saying that the scrollbars are not always windows and may be draw in by hand (ugh!) and may not be a Window at all. This will make my life more difficult. Ideas?
From my linked question (How to stop the bottom scrollbar from a CListCtrl from displaying?), I was using:
to resize the columns to the width of the client area. Turns out, by using
GetClientRect()
instead, I don't have to subtract-4
or the vertical scrollbar width, making this no longer an issue.