Export (0) Print
Expand All
Expand Minimize

CListCtrl::SubItemHitTest

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

int SubItemHitTest( 
   LPLVHITTESTINFO pInfo  
);

pInfo

A pointer to the LVHITTESTINFO structure.

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

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

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);
	}
}

Header: afxcmn.h

Show:
© 2014 Microsoft