Share via


CListBox::GetTopIndex

intGetTopIndex()const;

Return Value

The zero-based index of the first visible item in a list box if successful, LB_ERR otherwise.

Remarks

Retrieves the zero-based index of the first visible item in a list box. Initially, item 0 is at the top of the list box, but if the list box is scrolled, another item may be at the top.

Example

// The pointer to my list box.
extern CListBox* pmyListBox;

// Want an item in the bottom half to be the first visible item.
int n = pmyListBox->GetCount()/2;
if (pmyListBox->GetTopIndex() < n)
{
   pmyListBox->SetTopIndex(n);
   ASSERT(pmyListBox->GetTopIndex() == n);
}

CListBox OverviewClass MembersHierarchy Chart

See Also   CListBox::SetTopIndex,