Click to See Complete Forum and Search --> : ListView and Scrollbar


Efitap
July 18th, 2006, 04:31 AM
I would like to ask you folks if you have a good idea of when I can detect that my listview is displaying a scrollbar, and when it isn't.

I have no issues with setting the proper width of my column headers to the proper width minus the scrollbar's width, but I need to know if I can send some form of notification message to the listview to ask if it's displaying a scrollbar or not, so that I can adjust the width of the column header accordingly.

Viorel
July 18th, 2006, 05:08 AM
I think you can try this:


bool hasVerticalScrollBar = (::GetWindowLong(hwndListControl, GWL_STYLE) & WS_VSCROLL) != 0;

In order to get the width of the scroll bar, try this:


int w = ::GetSystemMetrics(SM_CXVSCROLL);

I hope this works.

Efitap
July 18th, 2006, 06:05 AM
Thanks!