How can i know if my ListView has a item that have been clicked? Subclassing? If it is subclassing how can i subclass a windows that i did editing a resource?
Thank you
Printable View
How can i know if my ListView has a item that have been clicked? Subclassing? If it is subclassing how can i subclass a windows that i did editing a resource?
Thank you
Handling a click is very similar to handling a right click. Here is some sample code. This code goes in the parent's window procedure.
Code:case WM_NOTIFY:
lpnmhdr = (LPNMHDR)lParam;
if(lpnmhdr->hwndFrom == hwndList)
{
if(lpnmhdr->code == NM_CLICK)
{
LPNMITEMACTIVATE lpnmitem = (LPNMITEMACTIVATE) lParam;
LVHITTESTINFO hti = { 0 };
hti.pt = lpnmitem->ptAction;
ListView_HitTest(hListView, &hti);
if(hti.flags & LVHT_ONITEM)
{
TCHAR buf[100];
wsprintf(buf, TEXT("Item No. %d was clicked."), hti.iItem);
MessageBox(NULL, buf, NULL, 0);
}
}
}
break;
Thank you!