Working with the selected files is a valid option, true.
I didn't mean to resize the window. I would get the current height of the list control divided by the line height (which you also should know), thus knowing how many lines are displayed at the moment.
The only tricky thing I can imagine is finding out which is the first line currently displayed...