From: jeff on
Hi all-

I have created a OWNER_DATA list view using the REPORT view that works
real well. I can click on an item and get a NM_DBLCLK message and
then get the index of the item that was clicked.

My problem is handling NM_RETURN messages. If the user single-clicks
on an item, then moves up or down with the cursor, then presses ENTER,
I get the NM_RETURN message, but I don't know how to get the index of
the currently highlighted item. Can someone help me with this?

Also, is there a way (I'm sure there is) to Set / Highlight a specific
item? This would be in response to a query entry somewhere else.

Thanks,

Jeff
From: Preben Friis on
<jeff(a)automationservicesco.com> wrote:

> My problem is handling NM_RETURN messages. If the user single-clicks
> on an item, then moves up or down with the cursor, then presses ENTER,
> I get the NM_RETURN message, but I don't know how to get the index of
> the currently highlighted item. Can someone help me with this?

The lParam of the NM_RETURN notification points to a NMLISTVIEW structure
that contains the index of the item.

> Also, is there a way (I'm sure there is) to Set / Highlight a specific
> item? This would be in response to a query entry somewhere else.

Use LVM_SETITEM and set/clear the LVIS_SELECTED flag in the LV_ITEM
structure.