Obtaining the size of scroll bars

I'm using a multicolumned list control.  I'd like to set the column widths so that they fit neatly in the available space (that is, there's no horizontal scroll bar.)  

If I base these widths on the size returned by GetClientArea(), it works fine as long as there's no vertical scroll bar.  

I'd like to take the width of the vertical scroll bar into account - how do I find out what it is?    
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

milenvkConnect With a Mentor Commented:
Consider using
This returns the width in pixels of the vertical scroll bar.
fisham29Author Commented:
Oh, maybe ::GetSystemMetrics( SM_CXVSCROLL )???

Now how do I convert from pixels to client coordinates?
fisham29Author Commented:
Oops - you beat me to it.   You were fast!!!  Could you indulge my second question also??
fisham29Author Commented:
Never mind.  I guess in MM_TEXT, pixels ARE client coordinates.
You have to calculate in order to convert the pixels to client coordinates. You can assume that the scrollbar stays to the left of the right edge of the client rectangle. Then just subtract the pixels returned by GetSystemMetrics(SM_CXVSCROLL) from the right of the client rectangle and you'll get the left edge of the scrollbar in client coordinates.
All Courses

From novice to tech pro — start learning today.