|
-
May 14th, 1999, 11:04 AM
#1
Getting row number when double clicking listview control
Hi, I try to get the row number when clicking listview control by using HitTest(), but it doesn't.
I put the listview control on a dialog bar. Does it matter?
nIndex always returns -1 
void CMainFrame::OnDblclkList1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
CListCtrl* pListCtrl = (CListCtrl*)m_wndDlgBar.GetDlgItem(IDC_LIST2);
DWORD dwPos = ::GetMessagePos() ;
CPoint point ((int) LOWORD (dwPos), (int) HIWORD (dwPos)) ;
pListCtrl->ScreenToClient (&point) ;
int nIndex ;
if ((nIndex = pListCtrl->HitTest (point)) != -1)
{
CString string = pListCtrl->GetItemText (nIndex, 0) ;
MessageBox(string) ;
}
*pResult = 0;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|