tags:

views:

259

answers:

2

Is there an equivalent event to LBN_SELCHANGE but for a listview?

+2  A: 

Use LVN_ODSTATECHANGED for the event.

The event parameter is a pointer to a struct of type NMLVODSTATECHANGED. Use the uNewState and uOldState bit-fields to determine which of these are selection changes (because there are other changes as well). You're looking for the LVIS_SELECTED flag.

Jason Cohen
A: 
 case WM_NOTIFY:
  NMLISTVIEW *VAL_notify = (NMLISTVIEW*)VII_lParam;
  if(VAL_notify->hdr.code == LVN_ITEMCHANGED && VAL_notify->hdr.idFrom == IDC_SOMECONTROL  && (VAL_notify->uNewState & LVIS_SELECTED))
      {
      // Use VAL_notify->iItem as the new selected item
      }
OJW