Hi Nikolay,
I don't think you need such duplication. Why not to use a single rectangle? Looks like you always offset it to listview origin, so these rectangle differ in offset only, that's why you introduced another iterator_* helper. If I'm right about that it's better to add another OffsetRect than consistently maintain two variables with same meaning.
On second thoughts, having looked at this a bit, I think that if I weren't to have the two separate rectangles, I would still need to record the previous offset.
In the MarqueeHighlight function, the old draw rectangle is invalidated (which has been offsetted by the previous call), and then the old absolute rectangle is used for the inversion of the selected items. Then the new rectangle is created, and is adjusted by the present offset.
If we wanted to store only one rectangle, the previous offset - which would differ from the present offset - would also need to be stored, in order to cancel out the marquee draw and the item selection, which use different figures.
So it's either two rectangles being stored, or one rectangle with the previous offset. So I may as well leave it as it is, I think.
It might of course just be that I've been staring at this bit of code too long and have missed something obvious!
I'll submit a new patch anyway that adds in a check in WM_KILLFOCUS to stop a marquee selection if focus is lost.
Cheers,
Owen