Question

I'm trying to coordinate the scrolling of a CListCtrl with another control. Contrary to the documentation on Win 7 you can call CListCtrl::GetViewRect or CListCtrl::GetOrigin to get the viewable area coordinates.

e.g. If you're scrolled 10 units across CListCtrl::GetOriginwill return x=10, y=0.

Unfortunately Win XP does follow the SDK documentation which says "... if the control is in report view, the return value is always zero".

I'm sure this must be really simple but whats the best way to get the top left coordinates of a CListCtrl viewable area?

Was it helpful?

Solution

It turns out that GetScrollInfo will do the trick. The nPos value matches the window coordinates (ie the min/max range represents the total size of columns not a fixed 0-100 range).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top