CListCtrl::SubItemHitTest

Determines which list view item, if any, is at a given position.

int SubItemHitTest(
   LPLVHITTESTINFO pInfo 
);

Parameters

Return Value

The one-based index of the item, or subitem, being tested (if any), or -1 otherwise.

Remarks

This member function implements the behavior of the Win32 macro, ListView_SubItemHitTest, as described in the Windows SDK.

Example

void CListCtrlDlg::OnDblClk(NMHDR* pNMHDR, LRESULT* pResult)
{
   UNREFERENCED_PARAMETER(pResult);

   LPNMITEMACTIVATE pia = (LPNMITEMACTIVATE)pNMHDR;
   LVHITTESTINFO lvhti;

   // Clear the subitem text the user clicked on.
   lvhti.pt = pia->ptAction;
   m_myListCtrl.SubItemHitTest(&lvhti);

   if (lvhti.flags & LVHT_ONITEMLABEL)
   {
      m_myListCtrl.SetItemText(lvhti.iItem, lvhti.iSubItem, NULL);
   }
}

Requirements

Header: afxcmn.h

See Also

Reference

CListCtrl Class

Hierarchy Chart

Other Resources

CListCtrl Members